MSTest Runner error "Cannot be found"

Mark Thompson December 17, 2014

Have confgured both the "MSTest" and "VSTest.Console" executables under "Server Capabilities" and get the same result:

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:216)
	at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:98)
	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:75)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:181)
	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:101)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:108)
	at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:55)
	at java.lang.Thread.run(Unknown Source)

Have verified that the executables exist at their configured paths in "Server Capabilities", and that I can run the tests from a command prompt. Have also checked that the Bamboo service is running as a local user, not Local System.

I have found questions from many others having the same issue, and have not been able to find a suitable answer (having to resort to running scripts that call out to MSTest is not what i would consider an acceptable solution). Would really appreciate a proper solution to this issue, as it should be a straightforward process to set up, and one that I thought would be quite common for .NET developers.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 18, 2014

Hello Mark,

Thank you for your question.

MSTest.exe gets appended to the Path you include in the Server Capability created.

final File msTestExe = new File(capability.getValue(), "MSTest.exe";


Preconditions.checkArgument(msTestExe.exists(), msTestExe.getAbsolutePath() + " cannot be found"

Could you please update the capability from:

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

to:

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

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

vijeta sah October 24, 2017

Hi,

I have the correct path as suggested in this post but I am still getting this error.

The code has been developed in Visual Studio 2017 but the executable available for MSTest task is Visual Studio 2013. Can this be a problem and would this lead to the same error?

Thanks,

Vijeta

0 votes
Mark Thompson December 18, 2014

Thanks, that worked, but for the benefit of others, I thought it worth mentioning a couple of other points:

  1. I also went into Bamboo Admin > Server Capabilities and clicked "Detect Server Capabilities" - this added "Visual Studio 2010" and "Visual Studio 2012" executables to the list (with the path as you have noted for VS2012).
  2. I then removed the Server Capabilities I had added (MSTest.exe and VSTest.Console.exe).
  3. I went back to the MSTest Runner for my build, and selected "Visual Studio 2012" in the Executable drop-down. This seemed counter-intuitive at first, but as you describe above, MSTest.exe gets added to his path.
  4. My tests were then correctly run on the next build, but on the subsequent build, it failed due to the "testresults.trx" file already existing from the previous build.
  5. I then changed the Result Filename in MSTest Runner to "testresults-${bamboo.buildNumber}.trx", which generates a unique name each build, and all is now working well!

Thanks again for your help in understanding how this works - it would be nice if the documentation was a little clearer on this, but at least I have a working solution now and hopefully others benefit from it too. 

TAGS
AUG Leaders

Atlassian Community Events