Visual Studio Team Services

Call Microsoft TestManager’s mtm.exe to open Test Plans, Test Cases or Test Runs and their Results

If you happen to be in the situation where you do want to open TFS based Test Plans, Test Cases, Test Results and their individual Runs in your own application, you can either write a custom user interface or open Microsoft’s Test Manager mtm.exe with a specific set of command line arguments to directly jump to the aforementioned artefacts.

This information isn’t all too wide-spread so I thought it would help if I posted this information here as well.

Once you have the Microsoft Test Manager component installed, either if you have a Visual Studio Ultimate license or by purchasing a separe Visual Studio Test Professional one, it registers two new Uri handlers on your system, namely:

  • mtms:// – which is meant to be used if you connect to your TFS server via a SSL-secured http connection or
  • mtm:// – for plain, non-ssl http connections

Now to open the mentioned artifact types, use the following Uris (as mentioned, use mtms:// if your TFS server uses https):

Test Cases (or any other Work Item)

mtm://<TfsServerHostName>:<Port (optional)>/tfs/<TeamProjectCollection>/p:<ProjectName>/testing/testcase/open?id=<TestCase WorkItem Id>

Test Plans

mtm://<TfsServerHostName>:<Port (optional)>/tfs/<TeamProjectCollection>/p:<ProjectName>/testing/testplan/open?id=<TestPlan Id>

or (connects to the specified plan, making it the active test plan, the aforementioned only opens it):

mtm://<TfsServerHostName>:<Port (optional)>/tfs/<TeamProjectCollection>/p:<ProjectName>/testing/testplan/connect?id=<TestPlan Id>

Test Runs

mtm://<TfsServerHostName>:<Port (optional)>/tfs/<TeamProjectCollection>/p:<ProjectName>/testing/testrun/open?id=<TestRun Id>

Test Results

mtm://<TfsServerHostName>:<Port (optional)>/tfs/<TeamProjectCollection>/p:<ProjectName>/testing/testresult/open?id=<TestRun Relative Id>?runid=<TestRun Id>

The < .. > variables should be self-explanatory & you can get (read: see) almost all of the required Id’s manually in MTM, but the <TestRun Relative Id> is only used under the hoods and can only be retrieved via the TFS API (see Keith’s answer in the MSDN forums for sample code). 

Hope this helps!


Comments disabled.