问题描述
我们的构建过程将运行一系列针对Web服务的集成测试。这些测试中的每一个都会生成一个唯一的标识符,Web服务使用该标识符将日志消息与服务调用进行匹配。在测试期间,将标识符写入标准输出。
Our build process runs a series of integration tests that hit a web service. Each of these tests generates a unique identifier that is used by the web services to match log messages to service calls. The identifier is written to stdout during the tests.
这在使用Resharper在本地运行测试时效果很好,因为它将stdout输出与单个测试相关联。但是,从NUnit控制台应用程序运行测试时,stdout输出只能写到控制台,也可以写成与结果本身分开的文件,而不能被CruiseControl.NET用于显示测试结果的xml结果文件。
This works great when running the tests locally using Resharper, since it associates the stdout output to the individual test. However, when running the tests from the NUnit console application, the stdout output can only be written to the console, or a separate file from the results themselves, not the xml results file that is used by CruiseControl.NET to display the test results.
有人知道在xml结果文件中内嵌stdout输出以使其显示在NUnit Details屏幕上的方法吗?
Does anyone know of a way to include stdout output inline in the xml results file to make it show up on the NUnit Details screen?
推荐答案
您合并吗?
生成一个xml文件,您必须将其合并到构建协议中,然后配置,然后再看到任何输出。
Do you merge?
NUnit generates a xml file which you must merge into the build protocol configure the merge publisher before seeing any output.
<merge>
<files>
<file>Nunit*.xml</file>
</files>
</merge>
附录
如果可以将其写入单独的文件 foo.txt
,您始终可以合并到构建协议中。如上所述,您可以轻松地将xml文件合并到构建协议中,因此唯一的问题仍然是:如何将foo.txt转换为foo.xml。在NAnt中,您可以使用
AddendumIf you can write it to a separate file foo.txt
you can always merge into your build protocol. As written above you can easily merge xml-files to your build protocol, so the only question remains is: how to convert you foo.txt into a foo.xml.? In NAnt you could load the text file using
<loadproperty property="myprop" file="foo.txt"/>
<xmlpoke file="blank.xml" value="${myprop}" xpath="x/y/z" />
还要与和
这篇关于将NUnit测试的控制台输出放入xml结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!