从 MSBuild 内运行的 MSTest 捕获错误
我这样调用 MSTest:
<Target Name='UnitTests'>
<CallTarget Targets="BeforeUnitTests" />
<Exec Command='"$(VS90COMNTOOLS)..\IDE\mstest.exe" /testmetadata:$(SourceCodeRootFolder)ASA.File.Processing.vsmdi /testlist:buildtests' />
<CallTarget Targets="AfterUnitTests" />
</Target>
它正在运行,但无论成功还是失败,都不会向 MSBuild 错误文件写入任何错误。我正在使用这些参数运行 MSBuild:
/fl /flp:v=detailed;logfile=Errors.txt;errorsonly
我设置了电子邮件,以便在 Errors.txt 文件中出现错误时向我们的团队发送电子邮件。
I'm calling MSTest like this:
<Target Name='UnitTests'>
<CallTarget Targets="BeforeUnitTests" />
<Exec Command='"$(VS90COMNTOOLS)..\IDE\mstest.exe" /testmetadata:$(SourceCodeRootFolder)ASA.File.Processing.vsmdi /testlist:buildtests' />
<CallTarget Targets="AfterUnitTests" />
</Target>
It's running, but whether it succeeds or fails, no errors are written to the MSBuild error file. I'm running MSBuild with these parms:
/fl /flp:v=detailed;logfile=Errors.txt;errorsonly
I have emails set up to email our team if there are errors in the Errors.txt file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非 MSTest 程序本身失败,否则您不会在 MSBuild 日志文件中收到错误,至少不会在构建流的测试部分中收到错误。
MSTest 选项之一是将结果发布到 TFS;您应该能够使用标准通知设置,让您的队友知道发生了什么。或者,您可以在 MSTest 调用中使用
resultfile
参数,并根据您在文件中找到的内容进行解析/发布。我们使用 Codeplex 项目 Trx2Html 将结果发布到每个人都可以访问的内部网站。
Unless the MSTest program itself fails, you won't get errors in the MSBuild logfile, at least from the test portion of your build stream.
One of the MSTest options is to publish the results to TFS; you should be able to use standard notification setup there to let your teammates know what happened. Or you could use the
resultfile
parameter in the MSTest call and parse/publish based on what you find in the file.We use Codeplex project Trx2Html to publish the results to an internal website that everyone has access to.