I am trying to run some unit tests using PowerShell. I have a command that (sort of) works:
$output = & $vsTestPath $TestAssembly $logger $TestCaseFilter 2>&1
The problem with this is that the standard out and standard error streams don't come out in the right order - they get mixed up. One solution to this (from here) is to use cmd.exe, but I cannot get this to work. I feel like I've tried everything I can think of.
Here's what I have:
$vsTestPath = "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
$TestAssembly = "C:\IntegrationTesting\Test Application\Ads.Slms.IntegrationTesting.Web.Smartfill.dll"
$output = & cmd.exe /c $vsTestPath $TestAssembly 2`>`&1
This last line does not work. Wierdly, if I just have
$output = & cmd.exe /c $vsTestPath 2`>`&1
Then this runs, but of course it's no use to me. It's the second parameter that's the problem. Other things I've tried. How can I get this to run?
$output = & cmd.exe /c $vsTestPath $TestAssembly 2`>`&1
$output = & cmd.exe /c $vsTestPath,$TestAssembly 2`>`&1
$output = & cmd.exe /c "$vsTestPath" $TestAssembly 2`>`&1
$output = & cmd.exe /c """$vsTestPath""" $TestAssembly 2`>`&1
$output = & cmd.exe /c "$vsTestPath" "$TestAssembly" 2`>`&1
$output = & cmd.exe /c """$vsTestPath""" """$TestAssembly""" 2`>`&1