Jenkins 不生成测试报告文件



我正在使用pipline来构建和运行单元测试。

这是我的管道:

pipeline {
agent any
stages {
stage('Build') {
steps {
sh '''
./system/fuge/ci/docker-up.sh
./system/fuge/ci/docker-down.sh
'''
}
}
stage('Test') {
steps {
sh '''
./system/fuge/ci/docker-up-test.sh
'''
}
}
}
post {
always {
junit 'build/reports/**/*.xml'
}
}
}

我收到此错误:

[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] junit
Recording test results
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No test report files were found. Configuration error?
Finished: FAILURE

有人知道什么是问题吗?

我还使用node.js,lab.js进行测试

如果您在 docker 容器中运行测试,则可以通过将目录绑定挂载到主机(使用 docker-compose 卷,请注意,这可能会导致主机上的文件具有奇怪的权限(或在容器内完成测试后运行docker cp来将它们放回主机, 喜欢这个:

# make sure the directory exists on the host
mkdir -p build/reports
# make sure the directory we want to copy doesn't exist on the host
rm -rf build/reports/something
# copy directory from container to host
docker cp CONTAINER_NAME:build/reports/something build/reports/something

相关内容

最新更新