【问题标题】:jenkins not accepting xunit xml log from casperjsjenkins 不接受来自 casperjs 的 xunit xml 日志
【发布时间】:2013-08-22 15:11:36
【问题描述】:

我让 phantomjs 和 casperjs 在我的 jenkins 服务器上工作。 测试已执行并成功。但事情是这样的:

Casperjs 将其结果记录在 log.xml 文件中。我想我可以在我的 jenkins webUI 上显示那个 xml 文件的内容。我发现 jenkins 的 xunit 插件,但它没有按预期工作:

[37;42;1mPASS 12 次测试在 22.324 秒内执行,12 次通过,0 次失败,0 可疑,0跳过。 [0米

如您所见,测试成功

[32;1mResult 日志存储在 ../../build/frontendtests/log.xml
[0m 发布 Clover 覆盖率报告... 发布 Clover XML 报告... 发布 Clover 覆盖结果... 记录测试结果 [xUnit] [INFO] - 开始录制。 [xUnit] [INFO] - 处理 AUnit-3.x(默认)[xUnit] [INFO] - [AUnit-3.x(默认)] - 1 次测试 发现带有该模式的报告文件 'build/frontendtests/log.xml' 相对于 ' 用于测试框架 'AUnit-3.x(默认)'。 [xUnit] [错误] - 结果文件 ' 为了 指标“AUnit”无效。结果文件已被跳过。 [xUnit] [INFO] - 构建失败,因为“设置构建失败,如果错误”选项被激活。

Jenkins 构建失败,因为我的 log.xml 不适用于 AUnit。我也尝试过 JUnit 和 JSUnit。结果相同。但我不明白。 casperjs 导出 xunit xml 文件,我安装了 xunit 插件。但是插件没有读取我的 log.xml。

你有什么解决办法吗?也许我的詹金斯设置是错误的?有什么想法吗?

谢谢...

这是我的 log.xml

<?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>

【问题讨论】:

    标签: javascript testing jenkins frontend casperjs


    【解决方案1】:

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

    但我也测试了 XUnit 插件和 JUnit 选项,但仍然失败。我什至enabled more logs,但这并没有帮助。

    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 测试结果报告”插件进行一些测试并且解析顺利时。

    更新

    如您所见,问题出在with the casperjs file using attribute duration instead of time for testsuites nodes。 Xunit 在这方面比标准的 junit 更严格。

    我的建议:

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

    我会选择选项 #1 或 #2。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多