Bird
0
0

Given this Jenkins Pipeline snippet, what will be the output if test_login.py fails?

medium📝 Command Output Q13 of 15
Selenium Python - CI/CD Integration
Given this Jenkins Pipeline snippet, what will be the output if test_login.py fails?
pipeline {
  agent any
  stages {
    stage('Run Tests') {
      steps {
        sh 'python3 test_login.py'
      }
    }
  }
}
AJenkins marks the build as failed and stops the pipeline
BJenkins ignores the failure and continues the pipeline
CJenkins retries the test automatically
DJenkins marks the build as successful regardless
Step-by-Step Solution
Solution:
  1. Step 1: Understand Jenkins shell step behavior

    If the shell command exits with a non-zero code (test fails), Jenkins marks the build as failed.
  2. Step 2: Pipeline stops on failure by default

    Without special handling, Jenkins stops the pipeline on failure and marks build failed.
  3. Final Answer:

    Jenkins marks the build as failed and stops the pipeline -> Option A
  4. Quick Check:

    Shell failure = build fail + stop [OK]
Quick Trick: Shell command failure stops Jenkins pipeline by default [OK]
Common Mistakes:
  • Assuming Jenkins retries tests automatically
  • Thinking Jenkins ignores failures without config
  • Believing build passes despite test failure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes