These days, many companies are developing on the .Net platform with Visual Studio. What some don’t realize is that they can also do test management with TFS (Team Foundation Server) and MTM (Microsoft Test Manager). With both of these, they can manage the entire testing life cycles seamlessly including task assignment> test case design > test execution >result track. This blog gives a brief introduction on how to do test management with TFS, VS and MTM and make this happen including both manual test activities and automation test activities.

The precondition is: TFS is setup, and Visual Studio is installed. Here, we use TFS 2012 and Visual Studio 2012 for our example. For setting up TFS and Visual Studio, please see MSFT online.

Just FYI, some information about the tools:
1. TFS Web Access: TFS has a web access portal. Everything we do with TFS in fact is operated in this web portal. From TFS 2012, it is also called “Agile Project Management” sometimes.
2. MTM: MTM is a tool designed for test managers and testers to plan, manage, and execute both manual tests and automation tests. It was a separate component before. Since VS 2012, it has been merged into Visual Studio.
3. Visual Studio: I am sure you know this very well. Skip.

Let’s look at the overall process of testing activities in light of these tools. I will explain one by one after this.
1. Create backlog items (in TFS)
2. Create tasks (in TFS)
3. Design test cases (in TFS, VS, or MTM)
4. Link cases with tasks (in TFS, VS, or MTM)
5. Associate automation script (in VS)
6. Create test plan (in MTM)
7. Execute test cases (in MTM)
8. Check result (in MTM)

Test management with TFS

Main Screen for TFS

For our example, assume we already have created a project “testproject1” in TFS. Then, TFS web access is shown in the following screenshot.

1. Create backlog items
We are using the Scrum template. In an Agile project, we first need to create the Backlog items. Backlog items are all the things that we are going to do in the project.
By simply clicking “+ Product Backlog Item” button, you can create a backlog item.
Go to the “Work” page. You can see the item has been created successfully.

2. Create tasks (in TFS)
Now we need to create a task for this backlog item.
Go to the “board” page under Work.

Click the “+” icon to add a task. Fill in the necessary information. Let’s assign the task to a tester named “qabuild”.

3. Design test cases (in TFS, VS, or MTM)
You can design test cases in both TFS and VS.
a. In TFS:
To create a test case in TFS, click Work Items > New > Test Case. Then complete the test case steps and expected results on the right-hand side.

A tricky thing is: only after you update your TFS to TFS 2012 Update 3 like me, you can add steps here. Otherwise, the “Click or type here to add a step” won’t work; and you have to use the following way.

b. In VS:
To create a test case in Visual Studio, with the assigned user, connect to “testproject1” project from Team > Connect to Team Foundation Server, and select the correct project.

Then click “My Work” under Team Explorer Home.

You will see all the To-Do work is listed.

You can directly drag task “21 – Design test cases for Logon” to “In Progress Work”.
Then, to create a test case, click New > Test Case

Now you will see the following picture.
The funny thing is: Even though you can fill in the test case name and save it in Visual Studio, you cannot add steps for this case in VS.

This is most likely a defect in Visual Studio. Microsoft provides a workaround – clicking “Edit with Microsoft Test Manager” to edit in MTM.
Here’s how it looks in MTM.

4. Link cases with tasks (in TFS, VS, or MTM)
It’s a great idea to link your test cases to their original tasks. In this way, every test case is connected to a single requirement (it’s a common way in real projects to use a task as a requirement).
This can be done in TFS, VS, or MTM.
The following screenshots showthat doing this in VS. MTM and VS are all the same.

5. Associate automation script (in VS)
If you have created a CodedUI script for a test case, you can associate these scripts.
Please note:
a. This can ONLY be done in Visual Studio.
b. You need to rebuild the solution before associating the automation scripts.

6. Create test plan (in MTM)
Up to this point, we have created test cases. Now, we need to create a test plan to execute the test cases.
In the following screenshot, we’ve created a “Login Test” test plan, and added 2 test cases into it.

7. Execute test cases (in MTM)
It’s time to execute the cases in the test plan.
Go to Test tab in MTM. Make sure you are at the correct test plan, then you can right click a test case and start execution.

a. If the test case is not automated, you will see a window like this:

Click Start Test, you can fill “Pass” or “Fail” for each step.

If you find a defect, click the “Create Defect” icon to add a defect.

b. If the test case you want to run is associated with an automation script, right click the case, then select “Run with options”.

You are able to select on which build and environment you want to run the case.

Here’s what it looks like when the test case starts to run.

It will invoke the associated CodedUI automation script, and run the test in the script.

8. Check result (in MTM)
After case execution, go to Plan > Results to check the results.
You can change the view based on Test Suites, Test Configuration, and Testers separately.

It seems like a long process, but actually, by keeping all the information (requirements, test cases, automation scripts, and results) integrated into one tool it becomes a powerful asset in tracking your results. In the end this data can be analyzed to help you improve your testing process. More on that later…