Exception attempting to run MSTest Runner with MSTest 2012.

Note, we are able to successully build this Windows Phone 8 Project with Bamboo.

However, adding support for unit tests we get the following message: (We are at a loss as to what the problem actually is.)

System Error Details

Build Isis WinPhone 8 - Win Phone 8 Test - Default Job 8 : Executing Task 'ms test tasks(3)' of type com.atlassian.bamboo.plugin.dotnet:mstestRunner.
(java.lang.NullPointerException : Capability)

Occurrences: 3
First Occurred: 04 Feb 2013, 5:13:40 PM
Last Occurred: 05 Feb 2013, 8:54:54 AM
Agent: ci-windows-1
java.lang.NullPointerException: Capability
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
	at com.atlassian.bamboo.plugin.dotnet.tests.mstest.MSTestRunnerTaskType.execute(MSTestRunnerTaskType.java:84)
	at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:181)
	at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:94)
	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
	at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
	at java.lang.Thread.run(Unknown Source)

We are able to run the tests successfully on the build machine from the command-line.

6 answers

This widget could not be displayed.

So I found a work around solution where you manually call MSTest.exe and then parse the results.

1) Define custom server capability:

Capability Type: Executable
Type: Command
Label: MSTest
Path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe

2) Configure plan test job

3) Add Task > Script (*)

Inline Script Body: IF EXIST %1 DEL %1 
Argument: ${bamboo.buildResultKey}-${bamboo.buildNumber}.trx

4) Add Task > Command

Executable: MSTest
Argument: /testcontainer:[INSERT_YOUR_TEST.DLL] /resultsfile:${bamboo.buildResultKey}-${bamboo.buildNumber}.trx

5) Add Task > MSTest Parser

MSTest Test Results File/Directory: ${bamboo.buildResultKey}-${bamboo.buildNumber}.trx

* Tests will fail on re-run if the results file exists. This is optional but good defensive coding.

This widget could not be displayed.

Try the solution here:

https://answers.atlassian.com/questions/11464815

...the trick is that the MSBuild Runner will append "MSTest.exe" to the path you provide in the Capability, so make sure you specify the path to mstest (with trailing backslash), but don't include MSTest.exe at the end.

This widget could not be displayed.

We are also experiencing this issue with unit tests for a MS project. Was there any update on this exception?

This widget could not be displayed.
java.lang.IllegalArgumentException: mstest.exe cannot be found
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
	at com.atlassian.bamboo.plugin.dotnet.tests.mstest.MSTestRunnerTaskType.execute(MSTestRunnerTaskType.java:87)
	at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:188)
	at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:94)
	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
	at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
	at java.lang.Thread.run(Unknown Source)

Hitting the same problem in VS 2012 trying to get the mstest runner task to work. I tried defining a capability:

MSTest.exe (Visual Studio) C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe

This widget could not be displayed.
java.lang.IllegalArgumentException: mstest.exe cannot be found
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
	at com.atlassian.bamboo.plugin.dotnet.tests.mstest.MSTestRunnerTaskType.execute(MSTestRunnerTaskType.java:87)
	at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:188)
	at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:94)
	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
	at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
	at java.lang.Thread.run(Unknown Source)

Hitting the same problem in VS 2012 trying to get the mstest runner task to work. I tried defining a capability:

MSTest.exe (Visual Studio) C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe

This widget could not be displayed.

We are experiencing the same problem, is this work around the only way to fix this?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 4 hours ago in Featured Groups

Hi! I'm Cameron Deatsch, Head of Server at Atlassian and I'm hosting an AMA next week.

Hey team! I'm Cameron Deatsch, Head of Server at Atlassian. I'll be hosting an AMA over in our Questions section of the Community next Monday, so shoot me your questions, upvote others' question...

22 views 0 2
View post

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