1

我使用 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:. 出口 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 测试结果报告”,只需将“测试报告 XMLs”值指定为“mbunit-result.xml”。

为了解决这个问题,我配置了 Gallio 插件(通过作业的 config.xml 文件)以保留 jUnit 文件(Gallio 插件根据 MbUnit 测试结果创建),并查看了 junitResult .xml 文件 - 奇怪的是每个套件的每个“案例”元素都是空的。即一个套件可以是这样的:

<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 查看测试结果的见解将不胜感激!

4

2 回答 2

2

是的,这是由于gallio 3.1 的xml 格式发生了变化。看看这里,我提出了一个测试文件来解决这个问题......

http://code.google.com/p/mb-unit/issues/detail?id=399

于 2009-11-03T22:27:24.780 回答
0

mbunit-result.xml在您工作区的根目录吗?您可以使用工作区浏览器进行检查。如果它不在工作区的根目录,我建议在 Gallio 插件配置中指定路径。

于 2009-10-07T13:58:25.263 回答