Coded UI Test – Tip 2 – Assertions
Visual Studio 2010 comes with many new features not just to developers and architects also for the Testing World, and the one I’m going to show to day is Coded UI Test – A functional , UI testing based on .NET code. (How to Record Coded UI Test?)
As you know Coded UI Is Very powerful UI automation, but recording automation is not enough and you need to do some validation – to check if the actions you made result in the right way.
For validation in Coded UI Testing you need to use “Assertions”, asset is also used in Unit Test to verify the actual and expected result (and more).
To add assert to your Coded UI Test run the “Coded UI Test Builder” drag the viewfinder on top the control you want to perform the validation.
You will see Blue marker showing you the control you are catching, release the mouse button to get a list of all properties available for the specific control.
Choose the property you want to validate and Click “Add Assertion”.
If you having problem catching a control you can use the navigation dial control.
You can use the navigation dial to move around in the UI Tree
The following 4 operations are possible with the navigation dial.
- Navigate to the parent of the selected control.(Alt+Up)
- Navigate to the first child of the selected control. (Alt+Down)
- Navigate to the peer control to the left of the selected control. (Alt+Left)
- Navigate to the peer control to the right of the selected control. (Alt+Right)