Bird
0
0

In this Jenkins Pipeline:

medium📝 Command Output Q4 of 15
Selenium Python - CI/CD Integration
In this Jenkins Pipeline:
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'python3 test_login.py'
      }
    }
  }
}

What is Jenkins behavior if test_login.py exits with a non-zero status?
AJenkins ignores the failure and continues
BThe build stage fails and the pipeline stops
CThe test output is logged but build is marked successful
DJenkins retries the test automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand shell step behavior

    In Jenkins, 'sh' step fails the build if the command exits non-zero.
  2. Step 2: Effect on pipeline

    Pipeline stops at failure unless error handling is added.
  3. Final Answer:

    The build stage fails and the pipeline stops -> Option B
  4. Quick Check:

    Non-zero exit causes build failure [OK]
Quick Trick: Non-zero exit code fails Jenkins build [OK]
Common Mistakes:
  • Assuming Jenkins continues after failure
  • Thinking Jenkins retries tests automatically
  • Believing failure is ignored in logs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes