Exception attempting to run MSTest Runner with MSTest 2012.

Seamus McGowan February 4, 2013

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

1 vote
Mark Thompson December 18, 2014

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.

1 vote
Jeffrey Toce April 19, 2013

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.

0 votes
Jeffery Yeary July 14, 2013

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

0 votes
Jeffrey Toce April 18, 2013
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

0 votes
Jeffrey Toce April 18, 2013
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

0 votes
James Allenspach March 11, 2013

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events