Inside TFS

Test Cases and Test Suites with Microsoft Test Manager 2010

Mickey Gousset discusses test cases and test suites, and how they relate to test plans in Microsoft Test Manager 2010.

In the previous column, we looked at how you create a test plan, and modify its run and configuration settings. The next step in creating your test plan is to add test cases and test suites to the plan, to give your testers something to test with.

A Test Case is a new work item in Team Foundation Server 2010 that is mostly used to represent manual tests. This is a major change from TFS 2005/2008, where manual tests were Microsoft Word documents. Now in TFS 2010 they are work items, and first class citizens within the TFS 2010 structure. Test cases can be created using Team Explorer, but for this column we will use Microsoft Test Manager 2010.

As with most things in Visual Studio/TFS 2010, you have multiple ways to create test cases in MTM 2010. To continue from the previous column, you can create test cases from the Organize tab in MTM 2010. Figure 1 shows the Test Case Manager sub-tab of the Organize section.


[Click on image for larger view.]
Figure 1. Test Case Manager Sub-Tab

By default, this tab shows all the test cases contained in the team project you are currently connected to. You can change what is shown by clicking the Unfiltered button on the toolbar and changing the work item query used to populate the table.

To create a new test case, you have two options. The first is to click the New button, which will open the Test Case work item form to fill out. We will cover how to create a manual test using a test case in a future column. You also have the ability to copy an existing test case. This can be very useful if there is already a test case that defines most of the steps needed for your test. You can click the Create Copy button on the toolbar, and it will copy all the information from the current test case into a new test case. You can then edit the test case and save it.

To view the details of a particular test case, either double-click the specific test case, or click it once to highlight it, and select Open from the toolbar menu. Figure 2 shows you the Test Case work item form for a particular test case.


[Click on image for larger view.]
Figure 2. Test Case Work Item Form

Once we have our test cases created, the next step is to add the appropriate test cases to our test plan that we started earlier. A test plan is usually tied to an Area/Iteration, so we need to add all the test cases that test functionality built for that Area/Iteration. To do this, click the Plan tab at the top of MTM 2010 to switch to the planning section. This is where you add your test cases to your test plan, and create your test suites, as shown in Figure 3.


[Click on image for larger view.]
Figure 3. Adding Test Cases and Suites to your Test Plan

To add an existing test case to the test plan, select the test plan, and in the right-hand pane, click the Add button. This will open a work item query window, where you can create a query to return test case work items. Click the Run button to run the query, select the test cases that you want to add to the plan, and click the Add test cases button to add them to the plan.

Test Suites
While the above adds test cases directly to the test plan, you may want to group your test cases into logical groups. That can be done by creating a test suite, or multiple test suites, for your test plan.

There are two ways to create a test suite. To create a basic test suite, right-click on the test plan and select New Suite. This will create a new leaf node on the tree where you can enter the name of the test suite. You can then add test cases to the test suite as described previously. You can also nest test suites within test suites if you need to for organizational purposes.

There is a second way to create test suites, and that is with a work item query. Since test cases are just work items, you can create a work item query to retrieve the test cases you want for a particular test suite. One nice aspect of this is that, when new test cases are created that match the query criteria, they are automatically added to the test suite.

To create a test suite in this fashion, right-click on the test plan and select New Query-Based Suite. This will open a window (Figure 4) where you can specify the work item query. You can run the query from here to see what the results would be, then click the Create Test Suite button to create the test suite. The test suite will be listed in the test plan, and will automatically update with new test cases as appropriate.


[Click on image for larger view.]
Figure 4. Creating a Query-Based Test Suite

Now that you have created your test plan, with test suites and test cases, you are ready to run your tests. In upcoming columns, we'll look into how to create a test case, how to run a test plan, and how to interpret the results.

About the Author

Mickey Gousset spends his days as a principal consultant for Infront Consulting Group. Gousset is lead author of "Professional Application Lifecycle Management with Visual Studio 2012" (Wrox, 2012) and frequents the speaker circuit singing the praises of ALM and DevOps. He also blogs at ALM Rocks!. Gousset is one of the original Team System/ALM MVPs and has held the award since 2005.

comments powered by Disqus

Featured

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

  • TypeScript Tops New JetBrains 'Language Promise Index'

    In its latest annual developer ecosystem report, JetBrains introduced a new "Language Promise Index" topped by Microsoft's TypeScript programming language.

Subscribe on YouTube