VS2010 is now available for use and it have very good testing features in it.
Coded UI test is good feature provided by VS2010 to Record and play actions. This is very helpful for manual testers and developers to automate the testing process.
Let’s go through it by step by step procedure.
Step 1: Create a windows project using Visual studio 2010.
Step 2: Create a multiplication application which takes two input from textbox and given multiplication in third textbox.
Step 3: Add a test project in this solution by right click on solution -> add - >New Project, from the options select Test Project (Test Document). Click ok it will add a new test project in your application.
Step 4: Right click on newly created test project and add -> Coded UI Test , The Code UI test file will be added.
Step 5: Generate code for coded UI test screen will display , here you can select if you want to use existing recorded project or want to create new record project.
Step 6: Record screen is available now. Click on start recording, orange button.
Step 7: run the project in without debugging mode. And enter values and click on “Click” button, result appears.
Step 8: Click highlighted button to check recorded actions.
Step 9: to generate recorded code click on below highlighted button.
Step 10: Now drag and drop the blow highlighted button to tired text box ( 44 one). Now add assertion window appears, go to text property and right click -> add assertion .
Step 11: value and operator appears, here you can define the criteria (equal , greater etc). click ok.
Step 12: Code for recorded action and assertion is generated. Now in below careen you can see that our all the values 22, 2, 44 are there.
Step 13: Now let’s try by running it go to test-> debug - > All tests in solution
It will start filling those values in running screen, like you can see in below screen. After running the test it will show the test results both results are pass.
Step 14: Now lets go to code and change value of second textbox 2-> 3
Step 15: lets run the test again by test-> debug - > All tests in solution
Now you can see that test is failed and error message showing
Failed CodedUITestMethod1 MyTestProject Assert.AreEqual failed. Expected:<44>. Actual:<66>.
Which means that it is testing outcome as 44 while the result is 66.
0 comments:
Post a Comment