Syed Aslam Basha here. I am a tester on the Information Security Tools Team.
As continuation to my previous post, I want to show how to add assertions to coded UI test scripts. An example maybe that after launching a portal site you want to validate the user name.
- Press enter after this.UIMap.LaunchPortalSite(); (continuation from the previous blog post) , right click and select first option “use coded UI test builder”
- Click on the cross hair (third button) and drag and drop on the control you want to validate
- Add assertions form will be shown, you can navigate through the controls and reach the top most control or form and see its properties. You can add assertion to any of the properties shown.
- Right click on the inner text which we are interested in and click on add assertion
- Select comparator and comparison value and click on Ok
- Click on generate code button. Enter appropriate method name say ValidateUser and you are ready to validate the user name.
-Syed Aslam Basha (firstname.lastname@example.org)
Microsoft Information Security Tools (IST) Team