Unable to start test using mstest remotely with powershell

Viewed 641

I have a problem with running mstest.exe remotely using powershell. I need it to run automated tests on other machine.
I try to do the next command:

Invoke-command -ComputerName remoteComputer" -ScriptBlock { & "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe" "/testcontainer:myTests.dll"}  

And after that I get the next error:
Failed to queue test run 'username@machinename 2017-10-03 13:30:18': Unable to start the agent process.
So I see that mstest was started and tests were loaded but it can't start agnet process.
I tried to specify credentials but the same. Though I'm admin on both machines and run powershell as administrator.
When I run the same command on the remote machine locally in cmd then mstest works correctly. Did anyone has the similar issue?

3 Answers

Have you tried running something like:

Invoke-Command -Computer remote -ScriptBlock {Start-Process <mstest details>...}

The Invoke-Command should get you the remote access, the Start-Process should run the mstest

I don't know too much about how mstest works.

Try to create a schedule task in the remote computer with all you need and in your Script Block just call this task

I'm sure this is not the best way, but try to do this.

The task will run locally and I think the mstest will run without any problem.

When you run mstest.exe remotely using powershell you need to add "/noisolation" property to the command in the script block:

Invoke-command -ComputerName remoteComputer" -ScriptBlock { & "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe" "/testcontainer:myTests.dll" "/noisolation" }
Related