2017-08-20 166 views
1

我正在使用pipline来构建和运行单元测试。Jenkins不生成测试报告文件

这里是我的管道:

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' 
      } 
     } 

} 

我也得到thiss错误:

[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测试

+0

当你运行'./ system/fuge/ci/docker-up-test.sh'在jenkins之外,做一些xml文件出现在'build/reports/**/*。xml'中? – burnettk

+0

看起来像你的档案错误的文件夹,确保你有特定路径上的一些XML。您可以检查完成后运行管道的机器并找到xml,而不是修复已存档的命令。 –

+0

测试报告在我的码头集装箱中,我如何访问它们? –

回答

0

如果您在泊坞窗容器中运行你的测试,您可以通过绑定安装目录让他们回给主机出到主机(与泊坞窗,撰写卷注意这可能会导致奇怪的权限在主机上的文件),或通过运行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 
+0

我正在使用docker-copmose,我还需要与詹金斯合作... –

+0

您能否请您尝试以上两种策略之一(这两种策略都适用于docker-compose和jenkins),然后在这里报告,几个小时之后就能设法让它工作? – burnettk

+0

C/P的作品,但我怎样才能获得容器名称,我怎样才能从文件夹中的所有测试不只是一个? –