Jenkins没有生成测试报告文件

时间:2017-08-20 00:44:08

标签: node.js jenkins junit lab

我正在使用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进行测试

1 个答案:

答案 0 :(得分:0)

如果您在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