Linking work items using tags
SpecSync for MTM can synchronize the scenarios with TFS/MTM test cases. In order to be able to use this test cases in TFS, you might want to link them to other work items. For example, if the scenario is describing the behavior of the user story #123, you make a link between the test case syncronized from the scenario and the story. This gives you better traceability and allows you to create requirement- or query-based test suites in TFS/MTM. For example you can create a test suite that contains all test cases (scenarios) that are related to user story #123.
Although you can establish this links manually, once SpecSync created the test cases from the scenarios, it is an error-prone manual process. A better way to do this is to mark the relation of the scenarios to other work items via tags and let SpecSync create the neccessary links between the work items.
For that you need to tag the scenarios with tags, like
@us:123, and specify the tag prefix (in this case
us) for the SpecSync command line tool.
specsync4mtm.cmd ... --wiLinksFromTags us
This will synchronize the scenario with the TFS/MTM test case and establish a link between the test case and the user story #123 work item.
Work item tags
The work item tags should follow the pattern @prefix:NNN, where prefix is a label of your choice (e.g.
wi) and _NNN _is the ID of the related work item (e.g.
The work item tag can be specified at scenario level or feature level. In the latter case it behaves like you would have applied the tag for all individual scenario. This can be useful if all scenarios in the feature file are related to a feature or a user utory work item.
If the work item with the specified ID does not exist or the user who preforms the synchronization does not have premission to it, SpecSync will display an error message for that particular scenario. If at least one scenario has failed to synchronize, the command line tool returns with the exit code 10.
Note: Tags, where NNN is not a valid number are ignored.
Using mutiple tag prefixes
In order to distingwish between the different relations in the feature file, you can also use and synchronize multiple prefixes. E.g. you can tag a scenario with
@bug:456 indicating that the scenario was related to the user story #123 and it fixes the bug #456.
In order to use multiple tag prefixes, you have to list them for the
--wiLinksFromTags option separated by commas.
specsync4mtm.cmd ... --wiLinksFromTags us,bug
Note: SpecSync does not check the type of the referred work item. Specifying
@bug:123 will also make the link between the user story #123 and the test case. Though you can establish different link types for the different prefixes.
SpecSync creates a "Tests" link type between the test cases and the other work items by default. If you want to establish another kind of relationship (e.g. Child), you can specify the link type for the --wiLinksFromTags option in a prefix/type form.
specsync4mtm.cmd ... --wiLinksFromTags us/Child
Note: The link type name is case sensitive and might contain spaces. In this case the option value has to be surrounded with quotes (e.g.
--wiLinksFromTags "xyz/Tested By")
Note: Currently changing the name type will not trigger the re-synchronization of the scenario. If the scenario has been synchronized with the wrong link type already, you have to make a small change in the scenario to force synchronization.
- Existing test case links are not removed automatically, even if you remove the tag from the scenario. They have to be removed manually.
- Links are not supported for two-way synchronization yet