I had the same issue. This is what works for me
foreach($testFolder in $testFolders)
{
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE"
$testPath = Join-Path $testFolder.FullName ( $testFolder.Name + ".dll" )
$resultPath = Join-Path $PRIMARYWORKSPACE ( $testFolder.Name + ".trx")
$testSettingsPath = Join-Path $PRIMARYWORKSPACE (join-path
"CoreBuildToolsPackage" "Jenkins.testSettings")
$command = 'mstest.exe /testcontainer:' + $testPath + "
/resultsfile:"+$resultPath + " /testsettings:"+$testSettingsPath
cmd.exe /c $command
}
Here the $testFolders are just all the folders that contain test assemblies.
The key part is to set the location and then use the cmd.exe
On Tuesday, September 4, 2012 8:34:48 AM UTC-4, Arve Knudsen wrote:
>
> Hi guys
>
> I've configured the MSTestRunner plugin to use the following path to
> MSTest (sans quotes): 'C:\Program Files (x86)\Microsoft Visual Studio
> 11.0\Common7\IDE\mstest.exe'. When building, MSTest gets invoked 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%%
>
> This leads to the following error:
>
> 'C:\Program' is not recognized as an internal or external
> command, operable program or batch file.
>
> This must be a problem with MSTestRunner surely, as I have configured it
> with the correct path to MSTest? Is there any way to work around this? I've
> also asked on stackoverflow:
> http://stackoverflow.com/questions/12263430/jenkins-mstestrunner-plugin-is-unable-to-launch-mstest-exe
> .
>
> Thanks!
> Arve
>