Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97797

Jenkins Pipeline - Python Unit Tests fail, but build is marked as successful

$
0
0

I am currently doing QA automated testing with Python and Selenium. I am using the following pipeline:

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

    }
   }

  }
  }
 }

My problem is that if a test fails, the build is still marked as success. I use the built in Python library for unit tests (unittest). Example:

... skipping actual tests

    Ran 3 tests in 0:00:18

 FAILED
 (Failures=1)

Yet still, the build is marked as success. Can anyone give me any tips, I would appreciate it!


Viewing all articles
Browse latest Browse all 97797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>