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!