Organizing Test Cases Using Test Suites

By using Microsoft Test Manager, you can organize test cases into a hierarchy of test suites inside test plans. You can run all of the test cases in a suite one after another, and you can set the state of a suite to indicate whether it is planned, in progress, or completed.

Test plans and suites are just a way of organizing test cases. You can add a test case to more than one suite or test plan, or none. Deleting a suite does not delete its test cases.

You can view, add, or delete suites in your test plan by choosing Testing Center, Plan, Contents. When you select a suite, you can see the test cases it references. 

Different kinds of test suite

 

Requirements

  • Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional

Create and delete suites by using the toolbar above the suites pane at the left of the window.

Create Different Types of Test Suites

You can create three types of suite:

  • Static test suites are like folders. A static test suite can contain both test cases and other suites. To create a static suite, choose New, Suite.

    The root suite of the test plan is a static suite.

  • Requirements-based suites are derived from Product Backlog Items, User Stories, or other requirements. The suite contains all the test cases that are linked to its requirement. This type helps you track how well each requirement has been tested.

  • Query-based suites show the results of a query that you define. For example, you could select all the test cases that have Priority = 1.

    [Visual Studio 2012.1] As another example, you could select all test cases that are linked to a product backlog item that is in the Approved state.

Copying suites from other plans. When you create a new test plan, you might want to copy some of the suites from an earlier test plan. For example, in each sprint, you will want to re-run many of the test cases that you ran in earlier sprints. The Copy button does not create new test cases. Instead, the copied test suites refer to the same test cases. If you want to create new test cases, see Copying and Cloning Test Suites and Test Cases.

Deleting suites. Delete a suite only if it has not been used. Otherwise, set its state to Completed. When you delete a test suite, any nested test suites are deleted, but the test cases it refers to are unchanged.

To add test cases to a static suite or a requirements suite, use the toolbars above the test case list.

Test cases toolbar

If you choose Add, a query appears for team work items. Edit the query and run it, and then select the test cases that you want.

Note Note

When you add a test case to a requirements suite, make sure that the test case is appropriate to verify the associated requirement. When you add a test case to a requirements suite, it automatically links to the requirement work item by using the Tested By link type.

Choose Order to arrange the order in which tests will be run in a static test suite.

Note that suites do not contain test cases. Instead, they contain references to test cases. Therefore, when you add, move, or remove a test case in a suite, you are simply changing references. The test case itself is not changed.

Drag a test case onto a requirements-based or static suite to move it.

  • Requirements-based suites: When you move a test case in or out, the Tested By link between the test case and the requirement work items is created or destroyed.

  • Query-based suites: You cannot add or delete a test case from a query-based suite, but you can copy test cases from it into a suite of another type.

CTRL+Drag a test case to make it appear in more than one suite.

Drag a test suite to move it in or out of a static suite.

To create a duplicate test case, select it and choose Copy. You can edit the duplicate test case separately. You can then move the duplicate into another test suite if you want.

To copy suites from another test plan, use the button in the toolbar above the suites pane. For more information, see Copying and Cloning Test Suites and Test Cases.

A requirements-based suite is associated with a requirement work item. Depending on your team project template, a requirement might be known as a product backlog item or a user story.

Requirements work items can be linked to test case work items. You can see these links in the requirements work item on the Tested By tab, and in the test case work item on the Tested Items tab.

A requirements-based suite automatically includes all the tests that are linked to the requirement. Whenever you add or remove a test case from a requirements-based suite, the link between the requirement and the test case is created or destroyed.

To add one or more requirements-based suites to a test plan, choose Add Requirements. A work item query opens. Edit it, run it, and then select the requirements that you want. A suite is generated for each requirement work item that you select.

[Visual Studio 2012.1] In the work item query, you can find requirements that are linked to work items that have particular properties. For example, you could find all the requirements that have a particular ancestor work item, or all the requirements that have implementation tasks. To do this, set the query type to Work Items and Direct Links or Tree of Work Items. Add clauses to select the type and properties of the linked work items. Run the query, and then expand the resulting items to see the links. Select the requirements for which you want to create suites.

When you choose New, Query-based suite, a work item query is created. You edit it to select the test case work items that you want. You can edit it again later. The query runs automatically every time you open or run the suite.

Creating or editing a query-based suite

You should not change the first two clauses in the work item query. They ensure that the work items are test cases in your project.

The most frequently used fields in additional clauses are State, Area Path, Iteration Path, Priority.

Run the query in order to verify that it finds the correct test cases.

[Visual Studio 2012.1 – Visual Studio and TFS] Linked and hierarchical queries

You can select test cases based on the properties of the work items that they are linked to. In the New Query or Edit Query page, set Query Type to Work Items and Direct Links or Tree of work items, and then set the query to filter on the linked work items.

These kinds of queries return pairs of work items and trees of work items. The query-based suite will include all test cases found in the result of the query, no matter what position they occupy in the pairs or tree.

Here are some examples of query-based suites that you could make by using linked queries:

  • All test cases that are not linked to a requirement of any kind, such as a product backlog item or user story

    Query-based suite using links Query-based suite using links
  • All test cases that are linked to a product backlog item that is in the Approved state

    Query suite for tests of approved requirements
  • All test cases that are linked to requirements that are scheduled for the current sprint (iteration)

You can set the state of a test suite to indicate whether you are ready to run its tests or whether its tests have all completed.

If you don't want to use this feature, leave the state at its default value of In Progress.

Test suite state switch

Set the state to inform other team members:

  • In Planning: The test cases in the suite are not yet ready to run.

  • In Progress: The test suite can be run.

  • Completed: The tests have completed and do not have to be re-run in this test suite. You might still run the same test cases in other test suites or test plans.

Important note Important

The tests in a test suite cannot be run unless its state is In Progress.

For a full discussion of running tests, see Running Tests in Microsoft Test Manager.

Test suites allow you to run all the tests in the suite in a batch, one after the other.

To run tests, choose Test, Run Tests.

Running all the tests in a suite

Only suites that are in the In Progress state are visible.

To run an individual test, use the Run button above in the test list toolbar. To run a suite of tests, use the Run button in the test suites toolbar. For more information, see How to: Run Multiple Manual Tests in a Test Suite.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft