Creating Tests for Product Backlog Items, User Stories, or Requirements
A good way to start a test plan is to add user stories, product backlog items, or other requirements to it. A requirement appears in the test plan as a special type of test suite – that is, a container for test cases. When you add or create test cases in a requirements suite, they become linked to the requirement so that you can easily track which requirements have been successfully tested as their implementation progresses.
Deriving test cases from requirements has several benefits. You can quickly see which requirements have tests attached to them. At the start of each sprint or iteration, it’s useful for the development team to work with user representatives to write out the steps of some test cases associated with each user story or requirement. This practice helps clarify the users’ needs and helps avoid potential misunderstandings. And as implementation and testing progress, you can see reports that show which requirements have been tested successfully.
As an alternative to writing test cases in advance, you can wait until the requirement has been implemented, and then perform exploratory tests linked to the requirement. You can record the actions you perform during the exploratory test, and generate test cases from them. The test cases are automatically included in the requirement’s suite. The test case lists the steps that you performed. This allows your team to repeat the same test quickly at any later time when the code is updated.
In this topic, we’ll use "requirement" to refer to any work item that has a type that is in the Requirements category. This includes user stories, product backlog items, and (in the Scrum project template) bugs.
Add a requirement suite to a test plan
Create or add test cases in the requirement suite
Create test cases from exploratory tests
- Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional
Add requirements to a test plan
Typically, you create a test plan for each iteration and area of your team project. Near the start of the iteration, you add the product backlog items, user stories or requirements of that iteration to the test plan.
In Microsoft Test Manager, choose Testing Center, Plan, Contents.
Choose Add Requirements.
In Add existing requirements, edit the query to find the requirements you want.
For example, you might add a clause to select the current Iteration Path. Or, you might choose requirements that are not already linked to test cases.
Choose Run to run the query and display requirements.
Select the requirements you want to add.
Each requirement you selected appears in the test plan as a requirements test suite. A requirements test suite has the special property that it always displays any test cases that are linked to the requirement. When you add or remove a test case from a requirements test suite, the test case is automatically linked to, or unlinked from, the requirement.
But my project doesn’t have all the requirements that I need.
If you want to add just one or two requirements, you can do that from Microsoft Test Manager. Choose New near the top right of the window.
If you want to add a complete set of requirements, see Create or Add to the Product Backlog.
Create or add test cases to the requirements suites
Each requirement should typically have one or more test cases. For example, a requirement A customer can choose products from the catalog might have test cases "Choose one product," "Choose two different products," "Choose the same product twice," and so on.
Select the requirements suite, and then in the details window choose New or Add.
You can also move test cases in or out of a requirements suite by dragging the test case from the details window to another suite.
Create Test Cases from Exploratory Tests
Some teams prefer to create tests only after each requirement has been implemented. In this style, you perform a test, and record your actions as a test case, so that they can easily be repeated later.
In Microsoft Test Manager, choose Testing Center, Test, Do Exploratory Testing.
Select a requirement work item from the list, and then choose Explore work item. Microsoft Test Runner starts.
Start your application, choose Start Test, and perform a test of your application.
Before completing the test, choose Create test case.
A new test case will be created. The actions you performed will be listed as steps of the test case. The test case is linked to the requirement, and is included in the test suites for the requirement.
You can edit the steps before you save the test case.
For more information, see Performing Exploratory Testing Using Microsoft Test Manager.