NUnitTest
-
hi i need to test the UI page which has two radio buttons. According to the selection of radio button by users functions will be called and those function uses 5 class files and in turn 5 methods. now i need to APPLY UNIT Test on above said functionality, how can i achieve this? what are the steps i need to start with.
-
hi i need to test the UI page which has two radio buttons. According to the selection of radio button by users functions will be called and those function uses 5 class files and in turn 5 methods. now i need to APPLY UNIT Test on above said functionality, how can i achieve this? what are the steps i need to start with.
Your classes should be designed in such a way that they can be unit tested without the actual involvement of UI elements. For example, in your case, a method should take an argument that is a flag to indicate which radio button was clicked. You can then apply text fixtures to this method and call it with different arguments to simulate selection of different radio buttons. To put it in another way, your code should not contain hard-coded logic that works differently for different selections of UI elements. It you write code that way, it is very difficult to unit test them.