Is it possible to run a unit test case after user has entered the values in the GUI Screen.Lets consider I have a NSTextFiled.I have written a test case to check the value of the textField.So I was running the test case from product->Test,My Screen is getting loaded and suddenly disappearing.Can I hold the screen and enter the values into the textfield and then test the value of textfield.Is it possible?
Share
Reading input from the user before running tests defeats the purpose of unit testing. Unit tests are meant to run automatically without requiring user input.
In your case you are trying to test what happens when the user enters a certain value in a text field. Suppose you write a test for what happens when the user enters 50 in the text field. Instead of inputting 50 in the text field, supply the value 50 in your test. By supplying the value 50 you can unit test your code without requiring user input.
You should also take a look at OCMock, which is a framework for creating mock objects in Objective-C. OCMock makes unit testing with Cocoa objects easier.