生成没有时间戳的.trx文件

时间:2019-04-14 10:30:29

标签: jenkins .net-core jenkins-pipeline jenkins-plugins vstest

在以下命令生成my-test.trx之前,但是通过更新服务器它会生成my-test_2019-04-14_09-59-39-114.trx。并且在文档(https://aka.ms/vstest-report)中未提及

dotnet test --logger "trx;LogFileName=my-test.trx"

现在,詹金斯中的这一步无法找到带有时间戳的文件。

step([$class: 'MSTestPublisher', testResultsFile:"$TEST_PATH/TestResults/my-test.trx", failOnError: true, keepLongStdio: true])

服务器的更新列表:

dotnet-runtime-deps-2.1:amd64 2.1.10-1
dotnet-host:amd64 2.2.4-1
dotnet-hostfxr-2.1:amd64 2.1.10-1
dotnet-runtime-2.1:amd64 2.1.10-1
aspnetcore-runtime-2.1:amd64 2.1.10-1
dotnet-runtime-deps-2.2:amd64 2.2.4-1
dotnet-hostfxr-2.2:amd64 2.2.4-1
dotnet-runtime-2.2:amd64 2.2.4-1
aspnetcore-runtime-2.2:amd64 2.2.4-1
dotnet-sdk-2.1:amd64 2.1.603-1
dotnet-sdk-2.2:amd64 2.2.203-1

有什么主意如何停止添加此时间戳或修复Jenkins代码?

1 个答案:

答案 0 :(得分:1)

通过以下方式修复了Jenkins管道:

script {
    TRX_FILE = sh (script: "ls $TEST_PATH/TestResults/my-test*.trx", returnStdout: true).trim()
}
echo "TRX_FILE : ${TRX_FILE}"
step([$class: 'MSTestPublisher', testResultsFile:"$TRX_FILE", failOnError: true, keepLongStdio: true])