In the previous versions of Team Foundation Server and Visual Studio, Test Plan and Test Suites were entities independent of work item tracking service. Since they were not work items, it was not possible to add a state or any field to it. This lead to stringent workflows. Test Case could be customized but the Test Suite or Test Plan were not customizable. It was a long awaited requirement that Test Plan and Test Suite be provided as a work item. This was needed in order to customize Test Plan and Test Suite artifacts. Visual Studio 2013 Update 3 now provides Test Plan and Test Suite as work items. Now we can do any customization to them like adding fields, adding state transitions and providing workflow. This can be used to create custom reports by marking the newly added fields as Reportable. We can even have versioning and history for them.
This article is published from the DotNetCurry .NET Magazine – A Free High Quality Digital Magazine for .NET professionals published once every two months. Subscribe to this eMagazine for Free and get access to hundreds of free .NET tutorials from experts
In this article, we will discuss benefits of Test Plan and Test Suites as work items, which can now be customized to suit the specific needs of an organization. We will find out how to change the workflow of Test Plan to make it more effective. We will add more fields to the existing definition of test suite work items and use them for creating reports. The process of customizing Test Plan and Test Suite is similar to existing work items provided with TFS. Finally we will touch upon the Shared Parameters concepts for Web Testing.
We can achieve following with this new feature
· The default states for Test Plan can be changed
· The additional fields can be added to the work item
· Custom fields can be added
In this article, we will customize Test Plan to add more transitions, add fields to it, provide rules to the field and use the field to create report. We will need Power Tools to achieve these. I have used a readymade machine from Azure which had Visual Studio 2013 Update 3 and Team Foundation Server 2013 Update 3 installed on it. If you have an Azure subscription, you can do the same or alternatively create a similar setup on your desktop environment.
Open VS > Select Tools > Process Editor > Work Item Types > Open WIT from Server and select Test Plan as work item.
Figure: Power Tool Selection for Work Item
We will start with the original workflow of Test Plan which looks as follows:
Figure: Original Test Plan
I am going to add a few more status to it named Testing, Ready for Sign Off and Completed. Adding a state is in accordance with the work item customization feature we have used previously. Select workflow tab and drag & drop state and transition link wherever required.
Figure: Customized Test Plan
We are going to create a group of Reviewer or Approver. Users in this group will be able to approve or review the Test Plan. We will add a few users in this group.
Figure: TFS Group
Figure: TFS Group Members
We will add a field in the Test Plan named Reviewer and provide a rule so that the value for the field can be any user who is member of the newly created Group. A new field created needs a reference name. We want to use this field in the report as a dimension so we will need to define it accordingly.
Figure: New Field Creation
The Allowed values will take input from the TFS group.
Now that we have finished with the customization of the Test Plan, let us find out how it looks by using Microsoft Test Manager 2013. I have created a Test Plan and added a couple of Test Suites to it.
Figure: Microsoft Test Manager View
As you can see, first Test Suite has 2 test cases while the second has 3 test cases in it. Let us open the Test Plan and view it.
Figure: View of Customized Test Plan
Observe that the new field is shown below the field State. It also shows the allowed values. In this case, there are 2 users in the Reviewer group who can approve or review the Test Plan.
The current State of the Test Plan is Active. We can change the state to the newly added states and depending upon the transitions we have specified.
Figure: Customized State in Test Plan
The state can change from ‘Active’ to ‘Testing’ to ‘Ready for Sign Off’. Finally we can change the state to Completed. At any point of time, we can change the state to Inactive saying that this Test Plan is no longer in Active state.
With these kinds of states, we can view the Test Plans in different states. This can be achieved by using a query:
Figure: Test Plan Query
The query fetches all the Test Plans which are in ‘Ready for Sign Off’ State. This query can be stored for further use. We can even create an ad-hoc report using Report Builder for this new functionality.
I have created a report which shows Reviewer wise Test Plan Status. It shows consolidated matrix of various states and their respective reviewers or approvers.
Figure: Test Plan Status Report
I have also modified Test Suite to add other Test Types to it.
Figure: Customized Test Suite View
As you can see, I have added types like ‘Functional’, ‘Regression, ‘System Integration Testing’ and ‘User Interface Testing’. We can add more types if required like ‘UAT’.
I have also created a graphical report which shows the total number of Test Suites in each type.
We have seen so far how the Test Plan and Test Suites are treated as work items and are fully customizable.
I will discuss another feature called Shared Parameter which was added in Visual Studio 2013 and Team Foundation Server 2013 Update 2. With Web Testing, you can run Test Cases with multiple sets of data and multiple times. We can add parameter names to the Test Steps and provide the values of the parameters. These shared parameters will be automatically shown in all test cases which reference them. You can either convert existing parameters to shared or create new ones.
Figure: Shared Parameters in Web Testing
We discussed how customization of Test Plan and Test Suites help in creating reports and getting more information via queries. With Test Plan and Test Suite as work items, we can add fields and status of the fields also. We also discussed how Shared Parameters help in Web Testing.
Visual Studio 2013 and Team Foundation Server 2013 Update 3 has made a lot of features available along with providing Test Plan and Test Suites as work items. Customizing work items is a strength of Team Foundation Server which can be leveraged now for Test Plan and Test Suites. Creation of Queries and Custom Reports based upon Test Plan and Test Suite is possible as they are defined as work items.