Jenkins 使用的 PHPUnit 报告架构在哪里?
当测试中出现异常时,我在让 Jenkins 解析 xunit.xml 报告文件时遇到问题。 XML 看起来格式良好,因此仅通过查看它看不出任何问题。是否有一个 xsd 文件,我可以将我的 xml 与该文件进行比较,以查看实际上导致该文件无法解析的原因?
关于我的设置: 我在 Jenkins 中为 PHP 项目安排了一份夜间工作。我们使用的是 Cakephp 1.3,因此我们仍然使用 SimpleTest 而不是 PHPUnit。我能想到在使用 simpletest 时轻松生成报告 xml 的唯一方法是使用 stagehand_testrunner (http://redmine.piece-framework.com/projects/stagehand-testrunner)。在我的构建脚本中我做了类似的事情: cakerunner --cakephp-app-path=src/app --log- junit=build/test-results/junit.xml -R src/app/tests
这很好用,但是 jenkins 无法解析 junit.xml(如果有)测试中抛出异常。
I am having problems getting Jenkins to parse a xunit.xml report file when there are exceptions in the tests. The XML looks well-formed so I can't see any problem just by looking at it. Is there a xsd file somewhere that I can compare my xml against to see what actually causing the file to be unparsable?
About my setup:
I set up a nightly job in Jenkins for a PHP project. We are using Cakephp 1.3 therefore we are still using SimpleTest instead of PHPUnit. The only way I could figure out to easily produce the report xml while using simpletest was to use stagehand_testrunner (http://redmine.piece-framework.com/projects/stagehand-testrunner). In my build script I did something like:
cakerunner --cakephp-app-path=src/app --log- junit=build/test-results/junit.xml -R src/app/tests
This works great, however jenkins is unable to parse the junit.xml if there were exceptions thrown in the tests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我这太傻了。我相信 stagehand-test 运行程序已经将生成的 xml 格式化为 JUnit 格式。我试图将 JUnit xml 报告从 PHPUnit 转换为 JUnit。
在 Jenkins 中,我需要使用“发布 JUnit 测试结果报告”选项,而不是“发布测试工具结果报告”,后者用于与其他测试框架一起使用,将其转换为 JUnit 格式。由于我已经有一个 JUnit 格式的文件,因此不需要转换它。
我需要验证这一点,但我相信情况确实如此。
当我们转向 CakePHP 2.0 并使用 PHPUnit 时,我会很高兴。
This was silly of me. I believe that stagehand-test runner already formats the resulting xml in JUnit format. I was trying to convert a JUnit xml report from PHPUnit to JUnit.
In Jenkins I needed to use the option "Publish JUnit test result report" instead of "Publish testing tools result report" The latter is for use with other testing frameworks to convert them to JUnit format. Since I already have a file in JUnit format, I do not need to convert it.
I need to verify this but I believe it to be the case.
I will be glad when we move to CakePHP 2.0 and use PHPUnit.
xUnit Plugin 可以解决这个问题。
xUnit Plugin can solve this issue.