Challenge - 5 Problems
PyTest Jenkins Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
PyTest command output in Jenkins pipeline
You run the following PyTest command in a Jenkins pipeline step:
What will be the main effect of this command?
pytest tests/ --junitxml=results.xmlWhat will be the main effect of this command?
PyTest
pytest tests/ --junitxml=results.xml
Attempts:
2 left
💡 Hint
Look for the meaning of the '--junitxml' option in PyTest.
✗ Incorrect
The '--junitxml=results.xml' option tells PyTest to save test results in JUnit XML format to the specified file. This file can be used by Jenkins to display test reports.
❓ Configuration
intermediate2:00remaining
Jenkinsfile step to run PyTest and archive results
Which Jenkinsfile snippet correctly runs PyTest tests and archives the JUnit XML test report for Jenkins to display?
Attempts:
2 left
💡 Hint
Jenkins uses the 'junit' step to process JUnit XML reports.
✗ Incorrect
The 'sh' step runs PyTest with the '--junitxml' option to generate the XML report. The 'junit' step tells Jenkins to read and display the test results from that XML file.
❓ Troubleshoot
advanced2:00remaining
PyTest test results not showing in Jenkins
You configured Jenkins to run PyTest with '--junitxml=results.xml' and added 'junit "results.xml"' in the pipeline. However, Jenkins shows no test results after the build. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check if the XML file exists after the build.
✗ Incorrect
If PyTest fails before running tests, it may not create the XML file. Without the file, Jenkins cannot display test results.
🔀 Workflow
advanced2:00remaining
Best Jenkins pipeline stage order for PyTest and coverage
You want to run PyTest with coverage reporting in Jenkins and publish both test results and coverage reports. Which pipeline stage order is correct?
Attempts:
2 left
💡 Hint
Test results must be published after tests run.
✗ Incorrect
First run PyTest with coverage to generate reports. Then publish test results so Jenkins can show them. Finally, publish coverage reports.
🧠 Conceptual
expert2:00remaining
Why use '--junitxml' option with PyTest in Jenkins?
What is the main reason to use the '--junitxml' option when running PyTest in a Jenkins pipeline?
Attempts:
2 left
💡 Hint
Think about how Jenkins shows test reports.
✗ Incorrect
The '--junitxml' option creates a JUnit XML report file. Jenkins reads this file to show test results, failures, and trends in its interface.