1
如何使用Powershell腳本在解決方案目錄中運行所有單元測試。 我試着用下面的命令使用MSTest.exe運行單元測試的Powershell腳本
$tool = '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe"'
$x = ""; dir D:\DropBuildOutput\*.Tests.dll -Recurse | foreach { $x += "/testcontainer:""$_"" " }; iex "$tool $x"
但其錯誤below.How我可以運行所有測試並生成結果失敗?
iex : At line:1 char:79
+ ... (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcont ...
+ ~
You must provide a value expression following the '/' operator.
At line:1 char:79
+ ... STest.exe" /testcontainer:"D:\DropBuildOutput\_PublishedWebsites\SCJ. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token
'testcontainer:"D:\DropBuildOutput\_PublishedWebsites\aaa.aaa.aaa.aaa\bin\xxx.aaa.aaa.Tests.dll"' in
expression or statement.
At line:2 char:100
+ ... -Recurse | foreach { $x += "/testcontainer:""$_"" " }; iex "$tool $x"
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
+ FullyQualifiedErrorId : ExpectedValueExpression,Microsoft.PowerShell.Commands.InvokeExpressionCommand
仍然收到錯誤在行:4字符:102 + ... ...你-Recurse | foreach {$ x + =「/ testcontainer:」「$ _」「」}; &「$ tool $ x」 + ~~~~~~~~~~ + CategoryInfo:ObjectNotFound :(「C:\ Program Fil ... rms.Tests.dll」:String)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException –