2017-08-20 164 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的作品,但我怎樣才能獲得容器名稱,我怎樣才能從文件夾中的所有測試不只是一個? –