使用moles.runner.exe和MSTest.exe作为测试运行器

时间:2011-05-04 14:48:02

标签: mstest moles

当我执行moles.runner.exe,提供MSTest.exe作为跑步者时,我发现错误。

这是命令行:

moles.runner.exe MyAssembly.dll /r:MSTest.exe /args:/resultsfile:output.trx /args:/testcontainer:MyAssembly.dll

这是输出:

Microsoft Moles Runner v0.94.51023.0 -- http://research.microsoft.com/moles -- .NET v4.0.30319
Copyright (c) Microsoft Corporation 2007-2010. All rights reserved.

instrumenting...started
Microsoft (R) Test Execution Command Line Tool Version 9.0.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.

Invalid switch "MyAssembly.dll"
For switch syntax, type "MSTest /help"

当我用/ d(诊断模式)执行moles.runner.exe时,它会显示:

r>MSTest.exe MyAssembly.dll /resultsfile:output.trx /testcontainer:MyAssembly.dll

如何将moles.runner.exe定向到而不是将程序集名称作为测试运行器的第一个参数传递?

1 个答案:

答案 0 :(得分:4)

测试容器应指定为带有 / args 的moles.runner.exe,即:

/args:/testcontainer:MyAssembly.dll

相反,它应该用 / afs (RunnerAssemblyFormatString)指定,如下所示:

/afs:"/testcontainer:{0}"

这将指示moles.runner.exe在MSTest.exe-required / testcontainer参数中输出测试程序集。

相关问题