Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 如何将jenkins管道脚本与UnitTest++;1.4 我有一些C++代码,我在詹金斯上构建的。我运行UNITTEST ++ 1.4来测试C++代码,并生成一些测试结果*.xml < /C> > /P>_Unit Testing_Jenkins_Jenkinsfile - Fatal编程技术网

Unit testing 如何将jenkins管道脚本与UnitTest++;1.4 我有一些C++代码,我在詹金斯上构建的。我运行UNITTEST ++ 1.4来测试C++代码,并生成一些测试结果*.xml < /C> > /P>

Unit testing 如何将jenkins管道脚本与UnitTest++;1.4 我有一些C++代码,我在詹金斯上构建的。我运行UNITTEST ++ 1.4来测试C++代码,并生成一些测试结果*.xml < /C> > /P>,unit-testing,jenkins,jenkinsfile,Unit Testing,Jenkins,Jenkinsfile,只要我使用web前端配置jenkins build作业,这就很好: 对于新的构建工作,我必须使用jenkins管道插件,因此我必须编写一个jenkins文件。为了评估我的TestResults*.xml,我只找到了两个备选方案: junit 'TestResults*.xml' step([$class: 'JUnitResultArchiver', testResults: 'TestResults*.xml']) 但它们都不起作用。JUnitXML格式似乎不同于UnitTest++1.4

只要我使用web前端配置jenkins build作业,这就很好:

对于新的构建工作,我必须使用jenkins管道插件,因此我必须编写一个jenkins文件。为了评估我的
TestResults*.xml
,我只找到了两个备选方案:

junit 'TestResults*.xml'
step([$class: 'JUnitResultArchiver', testResults: 'TestResults*.xml'])
但它们都不起作用。JUnitXML格式似乎不同于UnitTest++1.4


有人知道正确使用UnitTest++1.4测试结果xml输出需要哪个Jenkinsfile语句吗?

解决方案是,如果使用JUnit插件,则使用xUnit插件。像这样:

step([
    $class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1,
    thresholds: [
        [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: ''],
        [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']
    ],
    tools: [[
        $class: 'UnitTestJunitHudsonTestType',
        deleteOutputFiles: true,
        failIfNotNew: true,
        pattern: 'result.xml',
        skipNoTestFiles: false,
        stopProcessingIfError: true
    ]]
])
您还可以使用为这些步骤创建代码