Jenkins Pipeline-Python单元测试失败,但是构建被标记为成功

时间:2019-08-15 07:13:22

标签: python selenium jenkins groovy pipeline

我目前正在使用Python和Selenium进行质量检查自动化测试。我正在使用以下管道:

pipeline{
    agent any

    stages{

        stage('Cloning GIT Repo'){

            .... skipping this part

        }

        stage('Installing requirements'){

            steps{
                echo 'Installing dependencies'
                bat 'pip install -r requirements.txt'
            }
        }

        stage('QA Testing'){

            steps{
                echo 'Running the unit tests'
                bat 'cd meta_tests & run_tests.bat & cd ..'
                bat 'cd tests & python test_suite.py '
            }

    post {
             always {
                publishHTML (target: [
                  allowMissing: false,
                  alwaysLinkToLastBuild: false,
                  keepAll: true,
                  reportDir: 'tests/reports/html_reports',
                  reportFiles: 'suite_results.html',
                  reportName: "BACU QA Testing Results"
                ])

            archive (includes: 'tests/reports/logs/*.log, tests/reports/html_reports/*.html, meta_tests/reports/*.html,
                     meta_tests/reports/assets/style.css')

    }
   }

  }
  }
 }

我的问题是,如果测试失败,则构建仍会标记为成功。我使用内置的Python库进行单元测试(unittest)。示例:

... skipping actual tests

    Ran 3 tests in 0:00:18

 FAILED
 (Failures=1)

然而,构建仍被标记为成功。谁能给我任何提示,我将不胜感激!

0 个答案:

没有答案