1
votes

I've configured the Jenkins MSTestRunner plugin to use the following path to the MSTest executable: 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe'. However, although this path is correct, the build fails as follows:

cmd.exe /C "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" "/resultsfile:/resultsfile testresults" /testcontainer:Project.Tests/bin/Debug/Project.Tests.dll && exit %%ERRORLEVEL%%
'C:\Program' is not recognized as an internal or external command, operable program or batch file.

What's the issue here, I thought this would be the normal way of configuring the MSTestRunner plugin as mstest.exe is installed beneath Visual Studio, which is again typically installed under 'C:\Program Files (X86)'? How do I work around this?

2
As the error message states, path parsing is stopping at the space and the rest of the path is taken as a argument here. So the command environment is literally trying to execute "Program" located at C:\. I am guessing this would work if you enclose the path with double quotes(").CIGuy
I don't know if this is an option for you, but could you add "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" to your Path environment variable on that machine and then just specify mstest.exe in the Jenkins configuration?CIGuy
Note that the above approach will require a restart of Jenkins after adding the Path variable in order for Jenkins command environment to pick it up.CIGuy
@CIGuy Yeah I figured that'd be the last resort, but I'm not very eager :/ I suppose maybe I could just write a commandline build step directly, sidestepping the problematic plugin altogether.aknuds1

2 Answers

4
votes

Have received confirmation from the plugin author that MSTestRunner 0.2.0 doesn't handle spaces in MSTest paths. I worked around the issue by instead creating an "Execute Windows batch command" build step in Jenkins that invokes mstest.exe directly, where I've surrounded the mstest.exe path with double quotes:

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:Project.Tests\bin\Debug\Project.Tests.dll /resultsfile:testresults.trx
1
votes

Found that my issue was 2 fold.

  1. File entries are from local workspace dir
  2. You must configure mstest in global tools and then select that instance within the build step.