How to: Create and Manage Query-Based Test Suites
To create a query-based test suite in your test plan, you define a query to select test cases. For example, you can create a query to select all test cases that are priority 1. By creating this dynamic test suite, any priority 1 test case that you create for your team project will automatically be added to this test suite. When you want to run all priority 1 tests, you can select this query-based test suite from your test plan. For more information about how to run the tests in your suite, see Running Tests.
The test suites in your test plan are added and managed as part of a hierarchy that includes a root node. The root node test suite has the same name as the test plan. It contains all other test suites. Test suites that are not query-based or created from a requirement can contain other test suites in addition to test cases. An example of this hierarchy is shown in the following illustration.
Important
Test suites can contain query-based test suites. However, query-based test suites cannot contain any other test suites.
You can use the following procedures to create and manage these query-based test suites:
Create a query-based test suite
Update a query-based test suite
Move a query-based test suite
Rename a query-based test suite
Delete a query-based test suite
Create a query-based test suite
To create a query-based test suite
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
From the Testing Center, click Plan and then click Contents.
The Contents pane is displayed.
Note
The test suite hierarchy has a root node that has the same name as the test plan. You can add test cases or test suites to this test suite root node, but you cannot rename it.
Select the location in the test suite hierarchy pane where you want to create this test suite, click the drop-down arrow next to New in the pane that shows the test suite hierarchy, and then point to Query-based suite.
The Create a Query-Based Test Suite dialog box is displayed.
To enter the name for your query-based test suite, type the name in Test suite name.
To add a new clause to your query, select Click here to add a clause.
Important
The first clause shown in Test suite query makes sure that only work items from your currently selected team project are returned in the results of the query. The second clause limits the results to only work items that have a test case category. Do not change these two clauses.
Click each column in the query clause to fill in the clause. If a column has a list of accepted values, a drop-down arrow appears when the column is selected. Click the drop-down arrow to select a value from the list. The following columns are available:
Query Column
How to complete
And/Or
Select And if this clause and the previous clause must be true to match a result. Select Or if either this clause or the previous clause must be true to match a result.
Field
The list for this field contains all the searchable work item fields used in the current Team Foundation Server. Use as many clauses and fields as you want to get useful results. Press ALT+DOWN ARROW or type the field name that you want to select.
Operator
Examples of operator choices are = (equal), <> (not equal to), > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), In, Was Ever, Was Never, and Contains.
Value
Specifies the value that you are looking for in the specified field. If there is a list of values to select from, click the drop-down arrow to select the one that you want. Team Foundation work item tracking includes some query variables to dynamically add values to your query. For more information, see Query Variables.
Repeat steps 5 and 6 to add all the values for which you want to search.
To see the results of your query, click Run to run the query.
(Optional) If the query returns many test cases, you might want to sort the results. Click a column header in the query results table to sort by that column.
(Optional) To group the query results by a column, drag a column header in the query results table to the title bar of the query results.
(Optional) To sort your query, click Column Options and then click Sorting. Choose the columns you that want to use, and then select if you want the sort order to be ascending or descending for each column. Click OK.
Note
The sort order of your query reflects the order of your tests in the test suite. In addition, this order is also used when you run the tests in the test suite.
When the query that you created returns the test cases that you want as members of your test suite, click Create test suite.
The query-based test suite is now displayed in the test suite hierarchy, and the test cases returned, based on this query, are displayed in the test suite details pane.
Click State and select from the list of states based on the following table:
State
When to use it
In Planning
If you are not yet ready to run the tests in this test suite.
In Progress
When you are ready to run the tests in this test suite.
Completed
When you have finished running the tests in this test suite and the quality level reached meets your goals.
Important
To run tests, you must set the status of a test suite to In Progress.
To change the default configurations for the test suite you created if you want them to differ from the default settings for the plan, click Configurations.
The dialog box is displayed that shows all the configurations for your team project and the current default configurations for your test plan.
You must first clear Use configurations from parent test suite, and then select the default configurations that you want to add and any that you want to remove.
Note
Changing the default configurations only affects new test cases or test suites that are added to this test suite. For more information about how to change the pairings of tests and configurations that are already in your test plan, see the procedure about how to update configurations for specific test cases.
(Optional) To add a new configuration or manage existing configurations, click Manage.
The Test Configuration Manager activity is displayed. For more information about creating configurations using the test configuration manager, see How to: Create Test Configurations.
To save your changes to the default configurations, click Save.
Update a query-based test suite
To update a query-based test suite
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
From the Testing Center, click Plan and then click Contents.
The Contents pane is displayed.
To update an existing query-based test suite, select a query-based test suite to select it from the test suite hierarchy.
To update the query, Click Edit query in the toolbar of the test suite details pane.
The Edit Query for Query-Based Test Suite dialog box is displayed. It shows the existing clauses for your query.
To update the query, change the existing clauses or add new clauses. For more information, see step 6 in Create a query-based test suite.
(Optional) If the query returns many test cases, you might want to sort the results. Click a column header in the query results table to sort by that column.
(Optional) To group the query results by a column, drag a column header in the query results table to the title bar of the query results.
When the query that you updated returns the test cases that you now want as members of your test suite, click Save query.
The test cases returned, based on this updated query, are now displayed in the test suite details pane.
Move a query-based test suite
Query-based test suites can be moved to be children of other test suites that are not query-based.
To move a query-based test suite
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
From the Testing Center, click Plan and then click Contents.
The Contents pane is displayed.
To move an existing test suite, click the test suite and drag it to the node that you want to be the new parent for this test suite.
The test suite is now a child of that node and it is displayed in the new location in the test suite hierarchy.
Note
You can only move a query-based test suite to be a child of an existing test suite. A query-based test suite cannot be a child of another query-based test suite.
Rename a query-based test suite
To rename a query-based test suite
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
From the Testing Center, click Plan and then click Contents.
The Contents pane is displayed.
To rename an existing test suite, right-click the test suite in the tree view of all the test suites and then click Rename.
Note
You can also press F2 to rename a test suite.
Type the new name for the test suite.
The test suite is now displayed with the new name in the test suite hierarchy.
Delete a query-based test suite
To delete a query-based test suite
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.
From the Testing Center, click Plan and then click Contents.
The Contents pane is displayed.
To delete an existing test suite, right-click the test suite in the tree view of all the test suites and then click Delete.
A confirmation dialog box is displayed.
Important
You will no longer be able to view the test results for the test cases or test suites in this test suite. Also, any test suites that are children of this test suite are permanently deleted.
To confirm deletion of the test suite, click Delete test suite.
The test suite is no longer displayed in the test suite hierarchy for this plan.
See Also
Tasks
How to: Create and Manage Test Suites
Concepts
Organizing Test Cases Using Test Suites
Other Resources
How to: Create Test Suites from Requirements or User Stories