gpt4 book ai didi

javascript - Jenkins 不接受来自 casperjs 的 xunit xml 日志

转载 作者:行者123 更新时间:2023-11-29 22:10:29 25 4
gpt4 key购买 nike

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

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

如你所见,测试成功

[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

<?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 选项,但仍然失败。我什至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。

关于javascript - Jenkins 不接受来自 casperjs 的 xunit xml 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18337233/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com