The information contained in this post is a work in progress update to the overall Visual Studio Team System 2010 walk through which can be found at:
This walkthrough guides you through the process for creating manual test cases and adding a test case to a test suite. In this scenario, Lucerne Publishing wants to add another test to the DinnerNow.net payment system. You have to add an end to end test for the purchasing scenario.
Suppose that you work on Lucerne team and have the task of testing the payment system for Iteration 2. First, you will create a manual test for this. You will add the steps to this test case and the expected results. Then you will add it to the existing test suite for the integrated payment system.
In this walkthrough, you complete the following tasks:
· Add a test case to an existing test suite.
· Add test steps to a manual test case.
Overall, performing these tasks will help you create and organize the tests for testing your application.
Before you begin this walkthrough, complete the following prerequisites:
To fulfill the walkthrough prerequisites
1. Follow these steps to open the new tool for generalist testers, Microsoft "Code Name Camano" for Visual Studio Team Test 2010 CTP:
2. To display the Microsoft "Code Name Camano" window, click Start, and then point to All Programs.
3. Point to Microsoft Visual Studio 2010 and then click Microsoft Code Name Camano.
4. To connect to a team project, point to Home, click the down arrow, and then click Connect to a Team Project.
5. To add a new Team Foundation Server, click Add.
6. The Add Team Foundation Server dialog box is displayed.
7. Type localhost, and then click Add.
8. To select the team project, click the name of the team project, DinnerNow, in the list. Then click Connect.
9. If you successfully connect to this team project, the name of the team project is displayed in the Microsoft "Code Name Camano" window following Team Project.
You can manage your test cases by organizing tests into test suites. You use a test suite to group test cases together. For example, you can group all test cases for a specific feature together. By grouping them in a test suite, you can now easily run all the tests in the test suite together. Test suites also help in planning your testing effort by working with this logical grouping of test cases.
To add a test case to an existing test suite
1. To display the Planning Activities Center, click Planning.
2. To display all the test suites, click Test Suite Manager in the Planning Activities sidebar.
3. To select the test suite, click End to End Test.
The tests that have already been added to the test suite are displayed in the test suite details panel.
Note There is a prebuilt test case that you can use instead of creating a test case yourself called Prebuilt: Complete Purchase Scenario.
4. To add a test, click New test case in the toolbar for the test suite details panel.
The new test case is displayed in the main editing pane of Microsoft "Code Name Camano" titled New Test Case 1*:.
5. To name the test case, type Complete Purchase Scenario in Title.
You use this title to identify the test case and search for it if you have to.
6. Check Area shows DinnerNow.
7. Click Owner to select Ellen Adams for the test case.
8. Click Priority to select 1 for the importance of the test case.
9. To save the test case, click the save icon in the toolbar.
Note After the test case has been saved, the test case identifier is shown in the title of the editing pane.
A test step might be an action only, or it might include validation.
To add test steps to a manual test case
1. Click Steps.
2. Click <click here to add a step>, type Verify that DinnerNow Web application is started as the Action for the first test step, and press Enter.
3. Type Enter 98101 in the Your Zip field as the Action for the next step.
4. Type Select American as the food type in the combo box as the Action for the next step.
1. Type Select Dinner as the meal of choice as the Action for the next step.
2. Type Select 1 hour as the time frame as the Action for the next step.
3. Type Click Find as the Action for the next step.
4. In the Expected Result column, type Check 3 restaurants are displayed: TailSpin BBQ, SouthRidge Subs, Northwind Bar and Grill.
a. Note If you type a value in the Expected Result column, the step is automatically set to a validation step, as indicated by the check mark icon.
5. Type Select Northwind Bar and Grill as the Action for the next step, and then type 12 items should be displayed as the Expected Result.
6. Type Select Classic Burger and Ice cream from the menu list as the Action for the next step, and then type Your menu today has a cost of $27 as the Expected Result.
7. Type Click Testimonials at the top of the screen as the Action for the next step, and then type Positive reviews are displayed for Northwind Bar and Grill as the Expected Result.
8. Type Click Checkout as the Action for the next step.
9. Type Select sign in using InfoCard as the Action for the next step.
10. Type Select Brad Sutton and click Send as the Action for the next step.
11. Type Click the radio button (Work) for Choose Delivery Address as the Action for the next step.
12. Type Click the radio button (Visa) for payment option as the Action for the next step.
13. Type Confirm Order as the Action for the next step, and then type Check Total is $27, Delivery address is 1 Microsoft Way, and Payment Option is Visa as the Expected Result.
14. Type Click Bring my Meal as the final test step.
a. Note You can mark any test step as a validation test step when you click Toggle Step Validation in the Steps Toolbar. When you run the test case, you must individually mark a validation test step as either passed or failed.
15. To save and close this test case, click Save and Close.
16. Important If you do not close the test case and continue to a different activity, the test case is now shown in Work in Progress in the sidebar. Click this test case to open it again.
This walkthrough guides you through the process for connecting existing test cases to user stories. In this scenario, Lucerne Publishing wants to be able to view which test cases will test which user stories for the DinnerNow.net payment system. This lets Lucerne publishing know the level of test coverage for each user story.
Suppose that you are a test lead at Lucerne Publishing. You want to link the existing manual test to the user story to check that the reviews are displayed for a restaurant because the test also covers this functionality.
In this walkthrough, you complete the following task:
Link Existing Test Case to a User Story
Link Existing Test Cases to a User Story
To link existing test cases to a user story
1. To display the Planning Activities Center, click Planning.
2. In the Requirements pane, double-click the requirement Customer Finds Reviews for Restaurant that you want to link to your test case.
The requirement is displayed.
4. Select the Test Cases tab.
5. To find the test cases, click Add.
The Add Link to User Story dialog box is displayed.
7. To find the test cases that you want to link to the requirement, click Browse to select a query to use.
The Choose linked work items dialog box is displayed
8. Select the following query: Team Queries/Open Test Cases, and then click Find.
The test cases in the query are displayed
9. Select the check box for the row that contains Complete Purchase Scenario.
10. To select to link these test cases to this requirement, click OK.
The Choose linked work items dialog box is no longer displayed
11. To add the links to this requirement, click Ok.
The links are now displayed.
12. To save the requirement, click Save and Close in the toolbar.
This walkthrough guides you through the process for running manual test cases and creating a bug when you find an issue. This bug will contain details of the computer that you used to run the test, diagnostic events for the application under test, a video recording, an automation strip and an action log of each UI action that the tester performed. In this scenario, Lucerne Publishing is required to run the manual tests for the DinnerNow.net payment system.
Suppose that you are the test lead at Lucerne Publishing. You have determined that you must run the test in this test suite, End to End Test, on Vista with Internet Explorer 7 for Iteration 2. You also want to collect diagnostic events to provide a developer with more information to debug if you find a bug. You create test settings, DinnerNow with Diagnostic Trace Collector, to use for your test plan to collect this data. You now create a test plan, Test Plan for Iteration 2, for your team project using these test settings. Then you add a test run for this suite and configuration.
Now suppose that you are a tester; you will start to run the tests. You will run the individual steps in a test case. You will create an automation strip for each of your UI actions that can be played back the next time that you want to run this test. When you find that the actual results for a test step do not match the expected results for a validation step, you will create an actionable bug that includes the diagnostic events from running the application. Then, you will save the test results.
In this walkthrough, you complete the following tasks:
Overall, performing these tasks will help you understand how to use test plans, test settings, test configurations and run your manual tests, create any necessary bugs and save the test results.
To review the test plan and test settings for the test run
1. To display the Planning Activities Center, click Planning.
2. Click Test Plan Manager in the Planning Activities sidebar.
3. To select the test plan, click Test Plan for Iteration 2 and then click Open.
The details of the test plan are displayed. You will see a test run End to End Test. This test run associates each test in the test suite, End to End Test, with the test configuration Vista and IE7. When a test from this test plan is run, the results will be associated with this test plan.
4. View the value for Test settings in the test plan information. This shows the test settings that will be used when any tests are run from this test plan.
5. To display the Testing Activities Center, click Testing. Then click Test Settings Manager in the Testing Activities sidebar.
6. To select the test settings, click DinnerNow with Diagnostic Trace Collector and then click Open.
The details of the test settings are displayed.
7. Click Data and Diagnostics to view what data you want to collect, or the actions to perform on a system for each role.
8. Click Cancel to close the test settings.
9. Close the Test Settings Manager.
Now that you have created a test plan that contains a test run, you can run any one of the manual test cases in this test run and create a bug if you find one. You can then save the test results from running the test case.
To run the manual test case, create a bug, and save the results
1. To display the tests that are ready to run, click Testing Overview in the Testing Activities sidebar.
3. In the left pane under Test Plans in Progress, expand the test plan Test Plan for Iteration 2 to show its test runs.
4. Under Test Plan for Iteration 2, click End to End Test.
The right pane displays the test cases in the selected test run.
6. In the right pane, click the test case Complete Purchase Scenario.
7. Click Run.
The Microsoft Test Runner opens.
The Test Cases panel displays the name of the test case. The test case, Complete Purchase Scenario, is selected. Its test steps are displayed in the Test Steps panel.
8. To dock the Microsoft Test Runner on the left, click the arrow next to the View icon and point to Dock Left.
9. To start the DinnerNow.Net application, double click the DinnerNow Web icon on the desktop.
10. To run the manual test case and create an automation strip at the same time, click Test and Automate.
Note The automation strip can be used for future playback of the test case. Also it can be used to create a coded UI test using the automation strip to generate code.
The Recording Settings dialog box is displayed. If it does not appear, click Test and Automate again.
11. Under Select recording types to capture, the three types of recordings that you want to be captured when you run the test case should be automatically selected.
· Action. This choice records information to a log file when you test. It writes text to describe the UI actions that you perform for each test step when you run the test.
· Background. This choice records the actions that you perform in the application under test. When you play back this recording, the actions are performed again in the application under test. This recording is known as an automation strip.
· Video. This choice creates a video recording of the desktop while you run the test.
12. Under Select applications under test, select DinnerNow.net – Windows Internet Explorer, and then click OK.
13. Important Wait until the counter in the Test Steps pane begins, the Test Steps header changes to blue, and a marker for the automation strip is displayed. The text End Test Case is enabled.
14. Perform the first step in the Complete Purchase Scenario test case: Verify that DinnerNow Web application is started.
Note Under the Test Steps pane, the Properties pane is displayed. This pane shows details for the test case and the individual test steps. Click the Test Step Details tab on the Properties pane to show the current test step and any data associated with it. You can copy this data and use it in your application under test. You can collapse and expand the Properties pane as required.
15. Click the exclamation mark to the right of the test step to mark it as passed, or right-click the test step and then click Pass.
16. Run the next two steps and mark them as passed.
You can pass each step or pass multiple steps, passing each step provides improved granularity when you playback using the automation strip.
Note To pause the test case at any time, click Pause.
17. Run the steps up to and including the testimonials step. When you click Testimonials, notice that the actual results do not match the expected results.
Note Wait until the DinnerNow application completes each action. The performance may be slow using the Virtual PC image.
19. Click the exclamation mark to the right of the test step to mark it as failed, or right-click the test step and then click Fail.
20. To take a screenshot to add to a bug, click the camera icon on the test steps toolbar, point to Rectangular Capture and drag an area for the screen shot.
21. To add a comment to this test step to add to the bug, click Test Step Results tab on the Properties pane. Then type Reviews are not displayed in Comments. (In the screenshot it actually says “Chuck’s Step step
22. To create a bug, click the Create New Bug icon on the Test Steps toolbar.
23. To give the bug a title, type Testimonials are not displayed in Title. (Screen Shot just says “Testimonial Bug”)
24. To see the test steps that are automatically added, click Details.
25. To see the input data and comments added, expand the test steps.
Note You can edit these test steps and comments as needed.
26. To see the system information that is automatically added about the computer that you are using for the test, click System Info.
27. To see the log files that are automatically added, click Other Links. The action log, the automation strip, the diagnostic trace log, and the video recording are added.
28. To update the priority, click Priority.
29. To save the bug, click Save.
The id number for the bug is now displayed.
30. To close the bug dialog, click the close icon.
31. Click Resume Test Case.
32. Scroll to the last test step and then click End Test Case.
33. The test case is now marked as failed in the Test Cases panel.
As you chose to record the test case, the recording is automatically stopped and saved.
Important It is required to mark a test step with a status if it is a validation test step. The overall result for a test case is based on the status for the test steps that were marked. If one test step is marked as failed, or it is not marked, then the test case will acquire a status of failed.
34. To save the test results, click Save and Close.
The Testing Activity Center is now displayed.
35. To view the saved test results and the linked files, double-click the test in the list of tests.
Note When a test has been run, it is now considered not ready to be run. You can reset the test if you want to run it again when the bug is fixed.
36. Close the DinnerNow.Net application.
This walkthrough guides you through the process for automating test steps and adding validation for these steps using a Coded UI Test. In this scenario, Lucerne Publishing wants to automate the test that has been created for the DinnerNow.net payment system. For more information about the overall scenario, see Scenario Overview.
Suppose that you are a tester on the Lucerne Publishing team and you have the task of automating the test steps for the payment system in Iteration 2. You want to create an automated UI test which will let you record the test steps and generate code from this recording. You will add validation for your test to verify the expected results. In this walkthrough, you complete the following task:
· Create a coded UI test to automate a test case
Overall, performing this task will help you create an automated test which can be used for regression testing your application.
To create a coded UI test and automate a test case
1. Open Visual Studio.
2. Click Test and then point to New Test...
The Add New Test dialog box is displayed.
3. To create a coded UI test, click Coded UI Test.
4. In the Add to Test Project dropdown, select Create a new Visual C# test project, then click OK.
The New Test Project dialog box is displayed.
5. Click Create.
The Coded UI Test dialog box is displayed.
6. To record your test steps and generate code to automate these steps, select Launch the recorder to generate code.
Visual Studio is minimized and the Test Recorder opens.
7. To start recording, click Record.
8. To start the DinnerNow.Net application, double-click the DinnerNow Web icon on the desktop.
9. Perform the following test steps using the DinnerNow.Net web site.
a. Type 98101 in Your Zip field.
b. Select American as the Food Type in the combo box.
c. Select Dinner as the meal of choice.
d. Select 1 hour as the time frame.
e. Click Find.
All these actions will be recorded by the Test Recorder and you can see them in the Recorded Actions section of the Test Recorder.
10. To use the Test Recorder to create the code for these test steps, click Generate Code.
The Enter Method Name dialog box is displayed.
11. To enter a name for the method for these test steps, type FindRestaurant in Enter Method Name and click OK.
13. To use the Test Recorder to add validation, click Add Validation.
The UI Control Locator tool opens.
14. Drag the crosshair to the image representing Northwind Bar & Grill in the DinnerNow.Net web application. Release the crosshair when the image is highlighted with a blue rectangle.
15. To add the Northwind Bar & Grill Image to the UI control list, click Add in the Microsoft UI Control Locator.
16. To display the properties of the NorthWind Bar & Grill Image, click Done.
17. Click the checkbox next to Exists. On the same row select AreEqual in the Comparator column.
18. To add an assertion in the code to check that NorthWind Bar & Grill Image exists, click Generate Code.
19. Click Edit UI Controls to move to the UI Control Finder view.
20. Repeat steps 14 – 18 for Tailspin BBQ and Southridge Subs images.
21. Close Microsoft UI Control Locator by clicking on the close icon.
22. Close the Test Recorder by clicking on the close icon.
24. Click on Test, point to Edit Test Run Configurations and click on Test Setttings. The Configuration Settings dialog opens up.
a. Click on Execution Criteria.
b. Scroll down to the Collectors section.
c. Uncheck the Enabled checkbox on Diagnostic Trace Collector.
d. Click Apply and then Close.
This step is a temporary workaround since the Diagnostic Trace Collector feature now conflicts with the running of Coded UI Test.
25. Right-click in the editor window for CodedUITestMethod1, and then click Run Tests.
This builds the test project with the coded UI test, and then runs the test. This will perform the test steps that you have created in this coded UI test.
The test results window displays the results for the coded UI test.
26. Right-click in the editor window for CodedUITestMethod1, select Edit Coded UI Test, then point to Record and Generate code to start the test recorder again.