tfscustom-fieldsmtm

add a new custom field to the test cases template in TFS 2017


I just installed TFS 2017 to use Microsoft Test Manager for test case creation. Seeing that we are creating user story separately I want add to the test cases a new field called "User Story ID".

I was going to add a new custom field using this guide: https://www.visualstudio.com/en-us/docs/work/customize/add-modify-field

In a few world I made this steps:

  1. Export the WIT definition (I specify the item Test Case).

    witadmin exportwitd /collection:CollectionURL /p:ProjectName /n:"Test Case" /f:"DirectoryPath/FileName.xml

  2. Add the FIELD element that specifies the name of the custom field to add. You must specify the following required attributes: friendly name, refname (reference name), and type. For more information, see FIELD (Definition) element reference.

  3. Add the Control element within the FORM section so that the custom field appears on the form within the group of elements where you want it to appear.

  4. Import the WIT definition file.

    witadmin importwitd /collection:CollectionURL /p:ProjectName /f:"DirectoryPath/FileName.xml"

Before post what I did I want just let you know that every time that I export and without edit anything I try to import again my file I receive this error message:

enter image description here

and it's the same error that I receive when I make my changes to the file so I don't really know what I have to do...

This are the lines that I added (i ADDED JUST 2 LINES AND I PUT A COMMENT "THE LINE THAT I JUST ADDED" AND SPACS TO LET UNDERSTAND WHICH ONE ARE):

<?xml version="1.0" encoding="utf-8"?>
<witd:WITD application="Work item type editor" version="1.0" xmlns:witd="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typedef">
  <WORKITEMTYPE name="Test Case">
    <DESCRIPTION>Server-side data for a set of steps to be tested.</DESCRIPTION>
    <FIELDS>

      /*THE LINE THAT I JUST ADDED*/
      <FIELD name="User Story ID" refname="TradeHub.TradeHubTestTeam.UserStoryID" type="String" />

      <FIELD name="Iteration ID" refname="System.IterationId" type="Integer" />
      <FIELD name="External Link Count" refname="System.ExternalLinkCount" type="Integer" />
      ...........
      ...........
    </FIELDS>
    <WORKFLOW>
      ...........
      ...........
    </WORKFLOW>
    <FORM>
      <Layout HideControlBorders="true">
        <Group Margin="(4,0,0,0)">
          <Column PercentWidth="90">
            <Control FieldName="System.Title" Type="FieldControl" ControlFontSize="large" EmptyText="&lt;Enter title here&gt;" />
          </Column>
          <Column PercentWidth="10">
            <Control FieldName="System.ID" Type="FieldControl" ControlFontSize="large" />
          </Column>
        </Group>
        <Group Margin="(10,0,0,0)">
          <Column PercentWidth="50">
            <Group Label="Status">
              <Column PercentWidth="100">
                <Control FieldName="System.AssignedTo" EmptyText="&lt;No one&gt;" Type="FieldControl" Label="Assi&amp;gned To" LabelPosition="Left" />
                <Control FieldName="System.State" Type="FieldControl" Label="Stat&amp;e" LabelPosition="Left" />

                /*THE LINE THAT I JUST ADDED*/
                <Control FieldName="TradeHub.TradeHubTestTeam.UserStoryID" Type="FieldControl" Label="User Story ID" LabelPosition="Left" />

                <Control FieldName="Microsoft.VSTS.Common.Priority" Type="FieldControl" Label="Priority" LabelPosition="Left" />
                <Control FieldName="Microsoft.VSTS.TCM.AutomationStatus" Type="FieldControl" Label="Automation status" LabelPosition="Left" />
              </Column>
            </Group>
          </Column>
          <Column PercentWidth="50">
            <Group Label="Classification">
              <Column PercentWidth="100">
                <Control FieldName="System.AreaPath" Type="WorkItemClassificationControl" Label="&amp;Area" LabelPosition="Left" />
                <Control FieldName="System.IterationPath" Type="WorkItemClassificationControl" Label="Ite&amp;ration" LabelPosition="Left" />
              </Column>
            </Group>
          </Column>
        </Group>
        <TabGroup>
          <Tab Label="Steps">
            <Control FieldName="Microsoft.VSTS.TCM.Steps" Type="TestStepsControl" LabelPosition="Top" Dock="Fill" />
          </Tab>
          <Tab Label="Summary">
            <Group>
              <Column PercentWidth="50">
                <Control FieldName="System.Description" Type="HtmlFieldControl" Label="Description" LabelPosition="Top" Dock="Fill" />
              </Column>
              <Column PercentWidth="50">
                <Control FieldName="System.History" Type="WorkItemLogControl" Label="Histor&amp;y" LabelPosition="Top" Dock="Fill" />
              </Column>
            </Group>
          </Tab>
          <Tab Label="Tested User Stories">
            <Control Type="LinksControl" Name="Tested">
              <LinksControlOptions>
                <WorkItemLinkFilters FilterType="include">
                  <Filter LinkType="Microsoft.VSTS.Common.TestedBy" FilterOn="reversename" />
                </WorkItemLinkFilters>
                <WorkItemTypeFilters FilterType="include">
                  <Filter WorkItemType="User Story" />
                </WorkItemTypeFilters>
                <ExternalLinkFilters FilterType="excludeAll" />
                <LinkColumns>
                  <LinkColumn RefName="System.ID" />
                  <LinkColumn RefName="System.WorkItemType" />
                  <LinkColumn RefName="System.Title" />
                  <LinkColumn RefName="System.AssignedTo" />
                  <LinkColumn RefName="System.State" />
                  <LinkColumn LinkAttribute="System.Links.Comment" />
                </LinkColumns>
              </LinksControlOptions>
            </Control>
          </Tab>
          <Tab Label="All Links">
            <Control Type="LinksControl" Name="GeneralLinks">
              <LinksControlOptions>
                <LinkColumns>
                  <LinkColumn RefName="System.ID" />
                  <LinkColumn RefName="System.WorkItemType" />
                  <LinkColumn RefName="System.Title" />
                  <LinkColumn RefName="System.AssignedTo" />
                  <LinkColumn RefName="System.State" />
                  <LinkColumn LinkAttribute="System.Links.Comment" />
                </LinkColumns>
              </LinksControlOptions>
            </Control>
          </Tab>
          <Tab Label="Attachments">
            <Control Type="AttachmentsControl" LabelPosition="Top" />
          </Tab>
          <Tab Label="Associated Automation">
            <Control Type="AssociatedAutomationControl" LabelPosition="Top" Dock="Fill" />
          </Tab>
        </TabGroup>
      </Layout>
    </FORM>
  </WORKITEMTYPE>
</witd:WITD>

the problem is that in this case as well when I try to re-upload the file I receive the same error message of every time.


Solution

  • Repeat Step 4. with VisualStudio 2015 installed, using the Developer Command Prompt for VS2015. VisualStudio 2013 doesn't know the element and therefore validates with an error.

    I did the same without PowerTools, just VisualStudio 2015 Update 3 installed - works like a charm.

    Or wait for VisualStudio 2017, which should be released in the beginning of march. I don't recommend installing VisualStudio 2017 RC - it broke my VisualStudio 2013 installation.