在管道中运行msTest项目作为代码(Jenkins)

时间:2017-08-01 11:35:52

标签: jenkins mstest jenkins-pipeline xunit

我正在尝试使用Jenkins的管道作为代码运行并显示单元测试(mstest)。将mstest的结果文件转换为xml:

之后
bat 'C:\\msxsl\\msxsl.exe C:\\Artifacts\\res.trx "C:\\msxsl\\mstest-to-junit.xsl" -o JUnitLikeResultsOutputFile.xml'

我想向stdout发送结果:

step([
                    $class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1,
                    thresholds: [
                        [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: ''],
                        [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']
                    ],
                    tools: [[
                        $class: 'MSTestJunitHudsonTestType',
                        deleteOutputFiles: true,
                        failIfNotNew: true,
                        pattern: 'JUnitLikeResultsOutputFile.xml',
                        skipNoTestFiles: false,
                        stopProcessingIfError: true
                    ]]
                ])

但是我得到的结果是:

[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing MSTest-Version N/A (default)
[xUnit] [INFO] - [MSTest-Version N/A (default)] - 1 test report file(s) were found with the pattern 'JUnitLikeResultsOutputFile.xml' relative to 'xxx' for the testing framework 'MSTest-Version N/A (default)'.
[xUnit] [WARNING] - All test reports are empty.
[xUnit] [INFO] - Check 'Failed Tests' threshold.
[xUnit] [INFO] - Check 'Skipped Tests' threshold.
[xUnit] [INFO] - Setting the build status to SUCCESS
[xUnit] [INFO] - Stopping recording.

为什么所有结果都是空的?这是输入.xml文件:

<?xml version="1.0" encoding="UTF-16"?>
<testsuites xmlns:a="http://microsoft.com/schemas/VisualStudio/TeamTest/2006" xmlns:b="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<testsuite name="MSTestSuite" tests="1" time="0" failures="0" errors="0" skipped="0">
<testcase classname="xxx" name="xxx_Success" time="0.3706411">
<system-out></system-out>
</testcase>
</testsuite>
</testsuites>

我做错了什么?

0 个答案:

没有答案