关于javascript:jenkins不接受来自casperjs的xunit xml日志

jenkins not accepting xunit xml log from casperjs

我在Jenkins服务器上使用了phantomjs和casperjs。
测试是成功和成功的。但事情是这样的:

Casperjs将其结果记录在log.xml文件中。而且我认为我可以在jenkins webUI上显示该xml文件的内容。我发现jenkins的xunit插件,但无法按预期工作:

[37;42;1mPASS 12 tests executed in 22.324s, 12 passed, 0 failed, 0
dubious, 0 skipped. [0m

您可以看到测试成功l

[32;1mResult log stored in ../../build/frontendtests/log.xml
[0m Publishing Clover coverage report... Publishing Clover XML
report... Publishing Clover coverage results... Recording test results
[xUnit] [INFO] - Starting to record. [xUnit] [INFO] - Processing
AUnit-3.x (default) [xUnit] [INFO] - [AUnit-3.x (default)] - 1 test
report file(s) were found with the pattern
'build/frontendtests/log.xml' relative to
' for the testing framework
'AUnit-3.x (default)'. [xUnit] [ERROR] - The result file
' for
the metric 'AUnit' is not valid. The result file has been skipped.
[xUnit] [INFO] - Fail BUILD because 'set build failed if errors' option is activated.

Jenkins构建失败,因为我的log.xml无法与AUnit一起使用。我还尝试了JUnit和JSUnit。结果相同。但是我不明白。 casperjs导出xunit xml文件,然后我安装了xunit插件。但是插件无法读取我的log.xml。

您有什么解决办法吗?也许我的Jenkins设置错误?有什么想法吗?

谢谢...

这是我的log.xml

1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?>   <testsuites duration="3.859">
    <testsuite name="Checking the portal search for http://www.xxx.de/suche/jeans" tests="1" failures="0" errors="0" time="2.687" timestamp="2013-08-20T14:12:55.953Z" package="./execute_search_tests">
      <testcase name="Subject equals the expected value" classname="./execute_search_tests" time="2.687"></testcase>
      <system-out></system-out>
    </testsuite>
    <testsuite name="Checking the portal search for http://www.xxx.de/suche/asjdfkshjkfhdsjkafhkjasd" tests="1" failures="0" errors="0" time="1.172" timestamp="2013-08-20T14:12:55.954Z" package="./execute_search_tests">
      <testcase name="Subject equals the expected value" classname="./execute_search_tests" time="1.172"></testcase>
      <system-out></system-out>
    </testsuite>   </testsuites>


注意:您已经使用AUnit选项配置了XUnit发布构建操作。这是Ada单元测试。

但是我还对XUnit插件和JUnit选项进行了测试,但仍然失败。我什至启用了更多日志,但这无济于事。

1
2
3
4
5
6
Aug 21, 2013 12:00:05 AM com.thalesgroup.hudson.plugins.xunit.service.XUnitService errorSystemLogger
SEVERE: [xUnit] - The result file '/Users/lacostej/.jenkins/workspace/test-casperjs-xunit/log.xml' for the metric 'JUnit' is not valid. The result file has been skipped.
Aug 21, 2013 12:00:05 AM com.thalesgroup.hudson.plugins.xunit.service.XUnitService warningSystemLogger
WARNING: [xUnit] - The file '/Users/lacostej/.jenkins/workspace/test-casperjs-xunit/log.xml' is an invalid file.
Aug 21, 2013 12:00:05 AM com.thalesgroup.hudson.plugins.xunit.service.XUnitService infoSystemLogger
INFO: [xUnit] - [JUnit] - 1 test report file(s) were found with the pattern 'log.xml' relative to '/Users/lacostej/.jenkins/workspace/test-casperjs-xunit' for the testing framework 'JUnit'.

但是,当我使用" JUnit测试结果报告"插件进行一些测试并解析正常时。

更新

您发现,问题在于使用属性持续时间而不是测试套件节点时间的casperjs文件。 Xunit在此方面比标准的junit更严格。

我的建议:

  • 使用标准的JUnit解析,就可以了
  • 如果您真的想使用xunit,则必须先将其修复,然后报告xunit解析的错误。这是我使用的测试用例配置:https://gist.github.com/lacostej/6287937
  • 或者尝试将自定义样式与XSL一起使用。您仍然需要调试并知道为什么不接受XML。
  • 我会选择选项#1或#2。