-->

jeudi 13 mars 2014

Add Test Case to the Task Board TFS


Problem description

Default TFS Scrum Board is too restrictive, we have to customize the Board in order to have a better owerview of the current sprint.

Here is an example of the default Task Board (3 columns and only Task in the Board)


Objective: Integrate the Test Case in the Board, add new status to Scrum Board, ensure the status change by drag and drop

Warning: Make sure to conserve a copy of original Xml file.


Step 1: Add required fields to the Test Case work item type
Prerequisite: You must have Admin permissions for your team project.

1- Open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:
cd %programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE
2- Export the Test Case work item type definition.
Witadmin exportwitd  /n:"Test Case" /collection:"http://MyServer:8080/tfs/DefaultCollection" /p:"MyProject" /f:"c:\temp\testcase.witd.xml"
3- Add the Activity and Stack Rank fields. If you don’t, the configuration won’t be valid. (You can add optionnal field like RemainingWork for example)
<FIELDS>
. . .
   <FIELD name="Activity" refname="Microsoft.VSTS.Common.Activity" type="String" reportable="dimension">
      <HELPTEXT>Type of work involved</HELPTEXT>
         <SUGGESTEDVALUES>
            <LISTITEM value="Testing"/>
         </SUGGESTEDVALUES>
   </FIELD>
   <FIELD name="Stack Rank" refname="Microsoft.VSTS.Common.StackRank" type="Double" reportable="dimension">

   </FIELD>
. . .
</FIELDS>
4- Add fields to the work item form for example after "Assigned To"
<FORM>
. . .
  <Group Label="Status">
              <Column PercentWidth="100">
                <Control FieldName="System.AssignedTo" Type="FieldControl" Label="Assi&amp;gned To" LabelPosition="Left" />
                <Control FieldName="Microsoft.VSTS.Common.StackRank" Type="FieldControl" Label="Stack Rank" LabelPosition="Left" />
                <Control FieldName="Microsoft.VSTS.Common.Activity" Type="FieldControl" Label="Activity" LabelPosition="Left" EmptyText="&lt;None&gt;" />
              </Column>
  </Group>
. . .
</FORM>
5- Import the updated Test Case definition.
Witadmin importwitd  /collection:"http://MyServer:8080/tfs/DefaultCollection" /p:"MyProject" /f:"c:\temp\testcase.witd.xml"


Step 2: Add the Test Case work item type to the Task Category
1- Export the categories definition
witadmin exportcategories /collection:"http://MyServer:8080/tfs/DefaultCollection" /p:"MyProject" /f:"c:\temp\categories.xml"
2- Add Test Case to thes Task Category
<CATEGORY refname="Microsoft.TaskCategory" name="Task Category">
    <DEFAULTWORKITEMTYPE name="Task" />
    <WORKITEMTYPE name="Test Case" />
</CATEGORY>
3- Import the updated categories files
witadmin importcategories /collection:"http://MyServer:8080/tfs/DefaultCollection" /p:"MyProject" /f:"c:\temp\categories.xml"


Step 3: Change Test Case Status in order to have  the same tatus as Task (Plus specific status)

1- Edit the Test Case workflow: (directly in xml file "testcase.witd.xml" or by using TFS PowerTools)
    1. Replace Design -> To Do
    2. Replace Deleted -> Removed
    3. Replace Passed -> Done
2- In our Project, we added a new status (Failed) for Test Case but this is optionnal and you can personalize your own workflow
(Here is an example of our Test Case Workflow)



Step 4: Add Column on the Task Board
1- Export the process config file
Witadmin exportprocessconfig  /collection:"http://MyServer:8080/tfs/DefaultCollection" /p:"MyProject" /f:"c:\temp\processconfiguration.xml"
2- Add new specific status for Test Case in the block TaskCategory
<States>
      <State type="Proposed" value="To Do" />
      <State type="InProgress" value="In Progress" />
      <State type="InProgress" value="Ready" />
      <State type="InProgress" value="Failed" />
      <State type="Complete" value="Done" />
 </States>
3- Import the updated process config file
Witadmin importprocessconfig  /collection:"http://MyServer:8080/tfs/DefaultCollection" /p:"MyProject" /f:"c:\temp\processconfiguration.xml"

Conclusion

Open the task board page, or refresh the page if it’s already open.
You should be able to select either Task or Test Case as a linked work item to a user story.



Warning: To add existing Test Case to the Task Board, you have to link Test Case as Child of the User Story.

Now, you can See Test Case in the Task Board with restriction on drag and drop:
possible status for Task are: To Do, In Progress et Done
possible status for Test Case are: To Do, Ready, Failed, Done

3 commentaires:

  1. Hello Fabien, could you explain why do you or your team need test cases in the task board and why didn't you replace completely tasks with test cases in the board?

    Regards,
    Alexander

    RépondreSupprimer
  2. Hello Alexander,
    The problem we had on this project is that our teams are not in the same office.
    Tester is in Belgium and developpers are in France. So for a good work synchronisation, we had to have each item type on the TFS Board.
    And finally, i think it's better to have the same virtual and physical Board.

    I don't replace Task with TestCase, because it's important to have both are on the Board.
    Task as for developpers and test case are for tester. It's possible to have developpement Task ans Tester Task but I need to have Test case item and not Task to link automation and run it. It's impossible with Task.

    Regards,
    Fabien

    RépondreSupprimer
  3. Excellent. Very helpful to show Test case on sprint board.
    Thank you.

    RépondreSupprimer