Setting up Bamboo to run MSTests and then display them in the TEST Tab

Bamboo 3.2

I am trying to get our Unit Tests to execute through the Bamboo CI.

I managed to take one of the dll containing the tests and adding that as a single MSTest Runner Task inside a second job as part of my main Plan.

This managed to run and output the MSTest output file (whatever.trx) to the TEST tab.

Problem is that I would now have to create a mstest task for each dll that needs testing (they in different unit test project folders) and then display their results.

Is there a different approach that I can take to running all the tests in one run and displaying them?

Many thanks

Righardt

1 answer

Hi Righart,

If you want to test multiple dlls using the same MSTest Runner Task, you need to produce a Test Metadata file and specify its location in the task configuration.

The MSTestRunner is just a wrapper around the mstest.exe executable provided by Visual Studio, so its worth reading about mstest.exe and the testmetadata switch.

From the MSTest.exe documentation:

You can use the /testmetadata option to run tests in multiple test containers.

The test metadata file is created for your solution when you create test lists using the Test Manager window. This file contains information about all the tests listed in the Test Manager window. These are all the tests that exist in all test projects in your solution.

You can change the test metadata file only by making changes that are reflected in the Test Manager window, such as creating or deleting tests, or changing a test's properties.

<th align="left">Note</th>

Because the test container contains tests that you can run, you must not specify both the /testcontainer and /testmetadata options in a single command line. Doing this would be ambiguous and would produce an error.

The test metadata file is an XML file that is created in the solution folder. This file is shown in Solution Explorer under the Solution Items node. A test metadata file has the extension .vsmdi, and is associated with the Test Manager window; that is, if you double-click a .vsmdi file in Windows Explorer, the file opens Visual Studio, and its contents. All the tests in a solution's test projects are displayed in the Test Manager window.

When you use the /testmetadata option, it is recommended that you indicate specific tests to run by using the /test option or the /testlistoption, or both.

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

464 views 2 5
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you