0
0
Selenium Pythontesting~20 mins

Jenkins integration in Selenium Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Jenkins Selenium Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Jenkins CLI command output
What is the output of this Jenkins CLI command when listing all jobs in a Jenkins instance with two jobs named 'BuildApp' and 'TestApp'?
Selenium Python
java -jar jenkins-cli.jar -s http://localhost:8080/ list-jobs
AERROR: No such command 'list-jobs'
B
BuildApp
TestApp
CBuildApp TestApp
DNo jobs found
Attempts:
2 left
💡 Hint
The list-jobs command outputs job names separated by new lines.
Configuration
intermediate
2:00remaining
Jenkins Pipeline to run Selenium tests
Which Jenkinsfile snippet correctly defines a pipeline stage to run Selenium Python tests using a virtual environment?
A
stage('Test') {
  steps {
    sh 'python3 -m venv venv'
    sh './venv/bin/pip install -r requirements.txt'
    sh './venv/bin/python -m unittest discover tests'
  }
}
B
stage('Test') {
  steps {
    sh 'pip install -r requirements.txt'
    sh 'python -m unittest discover tests'
  }
}
C
stage('Test') {
  steps {
    sh 'python3 -m venv venv'
    sh 'pip install -r requirements.txt'
    sh 'python -m unittest discover tests'
  }
}
D
stage('Test') {
  steps {
    sh 'virtualenv venv'
    sh './venv/bin/pip install -r requirements.txt'
    sh 'python -m unittest discover tests'
  }
}
Attempts:
2 left
💡 Hint
The virtual environment's pip and python executables must be used explicitly.
Troubleshoot
advanced
1:30remaining
Jenkins Selenium test failure due to missing display
A Jenkins job running Selenium tests on a Linux server fails with the error 'selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find X display'. What is the most likely cause?
AThe Jenkins user does not have permission to access the display server.
BThe Selenium WebDriver version is incompatible with the browser version.
CThe Python virtual environment is missing required packages.
DThere is no graphical display (X server) available on the Linux server.
Attempts:
2 left
💡 Hint
Selenium needs a graphical environment to run browser tests unless using headless mode.
🔀 Workflow
advanced
1:30remaining
Jenkins pipeline steps for Selenium test automation
In a Jenkins pipeline for Selenium Python tests, which sequence of steps is the correct order to ensure tests run successfully?
A2,1,3,4
B3,1,2,4
C1,2,3,4
D1,3,2,4
Attempts:
2 left
💡 Hint
You must have the code before setting up environment and installing dependencies.
Best Practice
expert
2:00remaining
Best practice for Jenkins Selenium test reports
Which Jenkins configuration is best to collect and display Selenium Python unittest XML test reports after a pipeline run?
AUse the 'Publish JUnit test result report' post-build action with the path to XML files generated by unittest.
BSend the XML files via email to the team without storing them in Jenkins.
CArchive the XML files as build artifacts without any test report plugin.
DConvert XML reports to HTML manually and archive the HTML files.
Attempts:
2 left
💡 Hint
Jenkins has built-in support for JUnit XML reports to visualize test results.