Jenkins VSTest Runner not working as expected

139 Views Asked by At

Having problems get VSTest plugin to work in Jenkins. So first this command line version works spot on so I know the paths etc are correct -

"C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" C:\Pelican\Debug\net6.0\Test.dll /TestCaseFilter:"SidebarMobile" /Logger:trx  

So back to Jenkins Dashboard>Manage Jenkins>Tools we have enter image description here

And in the job itself enter image description here

So when I run the job I see this in console output even though the paths are correct

Path To VSTest.console.exe: C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
no files matching the pattern C:\Pelican\Debug\net6.0\Test.dll
Executing VSTest: cmd.exe /C C:\Users\jenkins\AppData\Local\Temp\vstest7467014175321632084.bat && exit %ERRORLEVEL%
[Pi Mobile Tests] $ cmd.exe /C C:\Users\jenkins\AppData\Local\Temp\vstest7467014175321632084.bat && exit %ERRORLEVEL%

C:\Users\jenkins\AppData\Local\Jenkins\.jenkins\workspace\Pi Mobile Tests>C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\ /Tests:Sidebar /TestCaseFilter:"SidebarMobile" /UseVsixExtensions:false /Logger:trx 
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

So back to Jenkins Dashboard>Manage Jenkins>Tools we now have

C:\PROGRA~1\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\

I now see

Path To VSTest.console.exe: C:\PROGRA~1\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
no files matching the pattern C:\Pelican\Debug\net6.0\Test.dll
Executing VSTest: cmd.exe /C C:\Users\jenkins\AppData\Local\Temp\vstest17161354381707712024.bat && exit %ERRORLEVEL%
[Pi Mobile Tests] $ cmd.exe /C C:\Users\jenkins\AppData\Local\Temp\vstest17161354381707712024.bat && exit %ERRORLEVEL%

C:\Users\jenkins\AppData\Local\Jenkins\.jenkins\workspace\Pi Mobile Tests>C:\PROGRA~1\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\ /Tests:Sidebar /TestCaseFilter:"SidebarMobile" /UseVsixExtensions:false /Logger:trx 
'C:\PROGRA~1\Microsoft' is not recognized as an internal or external command,
operable program or batch file.

Any solutions please

1

There are 1 best solutions below

0
Kev On BEST ANSWER

I am now using "Execute Windows batch command", works fine from there