我使用 Hudson 作为 CI 服务器来构建几个不同的 .Net 3.5 项目。实际构建的东西效果很好。
然而,我使用 Gallio.Echo 作为构建的一部分运行 MbUnit v2 测试,虽然测试似乎运行良好,但 Hudson 声称没有运行任何测试。
在“使用 MSBuild 构建 Visual Studio 项目或解决方案”步骤之后,我有以下构建步骤:
类型:执行 Windows 批处理命令
命令:
“C:\Program Files\Gallio\bin\Gallio.Echo.exe”TestLibrary\bin\Release\TestLibrary.dll /rt:Xml /rnf:mbunit-result /rd:。
exit 0
当构建运行时,这会在控制台日志中给出以下输出:
Gallio Echo - Version 3.1 build 313
Get the latest version at http://www.gallio.org/
Start time: 09:06
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[ignored] Test TestLibrary/ConfigTests/LoadAndSaveTest
Generating reports.
Disposing the test runner.
Stop time: 09:07 (Total execution time: 10,210 seconds)
64 run, 64 passed, 0 failed, 0 inconclusive, 1 skipped (1 ignored)
因此,在我看来,毫无疑问测试确实在运行 - 并且 mbunit-result.xml 文件位于正确的位置并且看起来不错。
我还将项目配置为“发布 Gallio 测试结果报告”,只需将“测试报告 XML”值指定为“mbunit-result.xml”。
为了尝试解决这个问题,我配置了 Gallio 插件(通过作业的 config.xml 文件)以保留 jUnit 文件(Gallio 插件根据 MbUnit 测试结果创建的文件),然后我查看了 junitResult .xml 文件 - 奇怪的是每个套件的每个“cases”元素都是空的。即,套件可以如下所示:
<suite>
<file>C:\Documents and Settings\Administrator\.hudson\jobs\TestProject\workspace\temporary-junit-reports\TEST-TestLibrary.Encryption_Tests.xml</file>
<name>TestLibrary.Encryption_Tests</name>
<duration>0.0</duration>
<cases/>
</suite>
据我所知,该部分是各个单元测试应驻留的位置。另外,持续时间不应为 0.0。
正如你在上面看到的,我的 Gallio 版本是 3.1 build 313。这是否是由于这个 Gallio 版本的报告格式发生变化引起的(只是猜测,我不知道有任何此类变化)?
我在 Hudson v1.323 上运行,使用 Gallio 插件 v0.52。任何有关如何让 Hudson 查看测试结果的见解将不胜感激!
I am using Hudson as a CI server to build a few different .Net 3.5 projects. The actual build stuff works great.
However, I run MbUnit v2 tests using Gallio.Echo as part of the build, and while the tests seem to run fine, Hudson claims that there were no tests run.
I have the following build step right after the "Build a Visual Studio project or solution using MSBuild" step:
Type: Execute Windows batch command
Command:
"C:\Program Files\Gallio\bin\Gallio.Echo.exe" TestLibrary\bin\Release\TestLibrary.dll /rt:Xml /rnf:mbunit-result /rd:.
exit 0
When the build is run, this gives the following output in the console log:
Gallio Echo - Version 3.1 build 313
Get the latest version at http://www.gallio.org/
Start time: 09:06
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[ignored] Test TestLibrary/ConfigTests/LoadAndSaveTest
Generating reports.
Disposing the test runner.
Stop time: 09:07 (Total execution time: 10,210 seconds)
64 run, 64 passed, 0 failed, 0 inconclusive, 1 skipped (1 ignored)
So in my mind there is little doubt that the tests actually run - and the mbunit-result.xml file is in the right place and looking good.
I have also configured the project to "Publish Gallio test result report", just specifying the "Test report XMLs" value as "mbunit-result.xml".
To try to figure this out, I configured the Gallio plugin (through the jobs' config.xml file) to leave the jUnit files (that the Gallio plugin creates from the MbUnit test results) in place, and I took a look at the junitResult.xml file - the weird thing is that each and every of the "cases" element of each suite is empty. I.e. a suite can look like this:
<suite>
<file>C:\Documents and Settings\Administrator\.hudson\jobs\TestProject\workspace\temporary-junit-reports\TEST-TestLibrary.Encryption_Tests.xml</file>
<name>TestLibrary.Encryption_Tests</name>
<duration>0.0</duration>
<cases/>
</suite>
As far as I know, the section is where the individual unit tests should reside. Also, duration shouldn't be 0.0.
As you can see above, my Gallio version is 3.1 build 313. Could this be caused by changes in the report format of this Gallio version (just a guess, I don't know of any such changes)?
I am running on Hudson v1.323, with the Gallio plugin v0.52. Any insight on how to get Hudson to see the test results would be highly appreciated!
发布评论
评论(2)
是的,这是由于 gallio 3.1 的 xml 格式发生了变化。
看一下这里,我在其中提出了一个测试文件来解决此问题...
http://code.google.com/p/mb-unit/issues/detail?id=399
Yes, it's due to the xml format of gallio 3.1 which changed.
Have a look here, where I propose a test file to resolve this problem....
http://code.google.com/p/mb-unit/issues/detail?id=399
mbunit-result.xml
是否位于工作区的根目录下?您可以使用工作区浏览器进行检查。如果它不在工作区的根目录,我建议在 Gallio 插件配置中指定路径。Is
mbunit-result.xml
at the root of your workspace? You can check by using the workspace browser. If it is not at the root of the workspace, I would suggest specifying the path in the Gallio plugin config.