Continued from Visual Studio ALM … stepping through Brian’s HOLs (Part 5) – Debugging “IntelliTrace”, giving us the following bread crumbs to date:
Define Business Requirements > Project Planning > Code Discovery > Code Discovery > Class Coupling > Branch Visualization > IntelliTrace … today’s menu includes testing.
Visual Studio 2010 has a huge platter of new testing features and the three that fall under our magnifying glass are: Coded UI Tests, Manual Testing and test Case Management. Two of the quick reference posters that ship with the Visual Studio 2010 Quick Reference guidance are focused on testing:
Right, let’s complete the explorations, so that we can start building the quick reference poster.
||Suggested steps for the quick reference poster
Using the Test Case Management tool we can “manage”:
- Test Suites
- Test Cases
- Test Runs
- Test and Build Relationships
What caught my eye was the run settings for manual and automated test runs, which includes a variety of nuggets:
Be sure to step through Brian’s HOL if you are interested in the Test Manager. For the scope of the quick reference poster and stepping through the HOLs, I will limit this post to manual tests and coded UI tests.
The Microsoft Test Manager allows us to author manual test cases and associated test parameters, which can then be consumed the Microsoft Test Runner. Let’s have a quick sneak preview and work out the main steps, working through Brian’s HOL.
- Author Test Plan
- Launch the Microsoft Test Manager 2010
- Select Plan button, then End-to-End Tests and finally the New button.
- Capture Step
1. Manually capture steps and expected results, where applicable.
2. Manually capture the parameters, where applicable
- If you have a text file with the steps jotted down, create an empty action, hit cancel and paste the steps into the “dotted” cell.
- Run Test Plan
- Select Test button, then End-to-End Tests, select the Test we just created and finally the Run button.
- Select the Create Action Recording, which allows us to fast forward in future test runs, and Start Test.
- (1) Step through the documented steps and (2) mark each step as success or failure by selecting CTRL+Windows+Q and CTRL+Windows+W respectively.
- When we get to the sixth step, we bind the parameters to the field, by selecting the field, pressing CTRL-V in each text box and tabbing to the next. Notice that the parameters are bound to the fields for future iterations of the test.
- Run other iterations using the recorded steps, by selecting the steps you would like your digital companion to complete and then selecting Play. Steps 1-8, in this case, will replay in front of your eyes and you can then complete steps 9 and 10 manually.
- Save your test results when done, by selecting Save and Close.
- Analyze Test Results
- To analyze test Results, select your test suite, then the test case and click on View Results.
- You will note test result details, such as iterations, comments and a video recording for each step.
- Also note the attachments towards the bottom of the result, which contain a variety of attachments that were recorded during the test and which are available to help with debugging and diagnostics.
- Strive for re-use … sharing steps
- Re-use is important … especially with manual test steps which are repetitive and often similar.
- Open one of your test cases
- Select the steps you wish to share, right click and click on Insert Shared Steps, specify a name when prompted.
- To re-use, simply select Insert shared steps when editing a test case.
|Coded UI Tests
Using an existing Action Recordings
- To use an action recording, which could be a new recording or an existing one, we:
- Create a test project
- Add a Coded UI Test
- Select whether to create a new recording or use an existing
- We opt to use an existing order, which is attached to a Work item.
… looking at the actual work item, we can see the attached artefacts.
If we select edit, we can see the Test Manager emerging. More on this later.
- If we investigate the generated code, we can see the method CodedUITestMethod1, which is best shown as a sequence diagram:
- Once we are happy with the generated code, we can click anywhere in the CodedUITest source file and select Run Tests, or use the menu Test | Run.
- Going back to our previously generated CodedUItestMethod1, we can add an empty line, right click and select Generate Code for Coded UI Test, opting for Use Coded UI Test Builder.
- Using either use a prepared Internet Explorer Session or set it up on the spot. Then …
- Use the Coded UI Test Builder tool window
- Draw the cross hairs to the relevant position, for example, Quantity field
- This action loads the control properties window
- Select the relevant property, for example, Text.
- Add an Assertion to test the value.
- Select Generate Code in the Coded UI Test Builder tool window
- Re-run the test, which now includes the assertion test we just defined.
Data Driven Coded UI Test
- Going back to our test case (work item 41 in Brian’s HOL) we note the parameter values at the bottom. We can change, delete and add additional values.
- These values are digested by the following code in the coded ui test code.
- 41 = test case ID
- Using sequential use of the parameter values
- Setting the quantity field with the test context for new quantity.
Another great feature in the arsenal of testing tools.
I hope you had half as much perusing the summaries, as I had exploring the features. The next step if to consolidate the six posts into a quick reference poster. Watch the space…