java.lang.IllegalArgumentException : mstest.exe cannot be found

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

MSTest 2012 can not be used as an executable. The build fails with the following exception:

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)

Workaround

Make sure that Bamboo is running  as "Administrator" and not as "SYSTEM". Also, double check the path and other settings following the guidelines in this document: MSTest Runner.

Based on our research and checking through the source for the Bamboo .net plugin, it appears that the MSTest unlike other executables like the NUnit Runner and the MSBuild, can not be set as a capability. The MsTest capability is derived from the Visual Studio IDE itself. There is an option to use the MSBUILD outside of the Visual studio or if possible use Nunit Runner if an option. (Workaround ex. : Defining an msbuild target and running the mstest using a msbuild task.)

Note: 
In case it's running on an agent, you need to create the file bamboo-capabilities.properties file in the <bamboo-agent-home>/bin directory and populate the file with the following:

system.builder.devenv.Visual+Studio+2012=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

The remote agent should be restarted for the capability to be picked up. Please replace the PATH as appropriate.

Last modified on Jan 29, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.