mrz*_*mrz 10 qt qtestlib jenkins jenkins-plugins
我正在尝试将Jenkins xUnit插件用于我的Qt单元测试项目,但我无法使其工作......
这是我到目前为止所做的:
首先,我使用qmakebuilder插件构建我的单元测试项目(将.pro提供给qmakebuilder插件),然后我添加一个Execute Shell构建部分,我首先rm -f使用testResult xml文件,然后运行测试带有-xunitxml标志的二进制文件让它为我生成xml文件我用xml文件命名testResult.xml,换句话说:
rm -f /home/guest/QT/unitTest/testResult.xml
cd /home/guest/QT/unitTest
./tst_unittesttest -xunitxml > testResult.xml
Run Code Online (Sandbox Code Playgroud)
最后在Post Build Action中,我选择Publish xUnit test result并指定模式为*.xml.
但是构建作业会失败,这是我使用Jenkins构建作业时获得的输出:
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing QTestlib-Version N/A
[xUnit] [INFO] - [QTestlib-Version N/A] - 1 test report file(s) were found with
the pattern '*.xml' relative to '/home/guest/QT/unitTest' for the testing framework
'QTestlib-Version N/A'.
[xUnit] [ERROR] - The converted file for the result file '/home/guest/QT/unitTest
/testResult.xml' (during conversion process for the metric 'QTestlib') is not
valid.
The report file has been skipped.
[xUnit] [ERROR] - The plugin hasn't been performed correctly: hudson.util.IOException2:
Failed to read /home/guest/QT/unitTest/generatedJUnitFiles/QTestlib/TEST--735044756.xml
Build step 'Publish xUnit test result report' changed build result to FAILURE
Build step 'Publish xUnit test result report' marked build as failure
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,将测试结果xml文件转换为xUnit插件可以读取的内容存在问题.我的testResult.xml文件如下所示:
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="2" failures="0" tests="4" name="UnitTestTest">
<properties>
<property value="4.7.4" name="QTestVersion"/>
<property value="4.7.4" name="QtVersion"/>
</properties>
<testcase result="pass" name="initTestCase">
<!-- message="called before everything else" type="qdebug" -->
</testcase>
<testcase result="pass" name="myFirstTest"/>
<testcase result="pass" name="mySecondTest"/>
<testcase result="pass" name="cleanupTestCase">
<!-- message="called after myFirstTest and mySecondTest" type="qdebug" -->
</testcase>
<system-err>
<![CDATA[called before everything else]]>
<![CDATA[called after myFirstTest and mySecondTest]]>
</system-err>
</testsuite>
Run Code Online (Sandbox Code Playgroud)
但是TEST--735044756.xml是一行xml文件:<?xml version="1.0" encoding="UTF-8"?>
任何人都有一个线索,我在哪里做错了什么?生成输出xml文件应该有问题.
另外一点,我在系统日志Jenkins菜单中添加了log thingi,它似乎不是这个问题的原因...至少IMO
用-xmlflag 执行测试二进制文件就可以了.奇怪的是使用-xunitxml创建它<testcase>没有time属性的损坏的xml文件.仅运行测试二进制文件,-xml导致成功构建作业.
| 归档时间: |
|
| 查看次数: |
5534 次 |
| 最近记录: |