0
0
PyTesttesting~20 mins

Coverage report formats (terminal, HTML, XML) in PyTest - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Coverage Report Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
Output of pytest coverage terminal report
What is the output of the following pytest coverage command when run in a terminal?

pytest --cov=my_module --cov-report=term
AAn XML file named coverage.xml is created in the current directory.
BAn HTML file named index.html is generated in a directory named htmlcov.
CA summary table printed in the terminal showing coverage percentages per file and total coverage.
DNo output is shown; coverage data is only saved internally.
Attempts:
2 left
💡 Hint
Think about what the 'term' option means for coverage reports.
Predict Output
intermediate
1:30remaining
Result of pytest coverage HTML report generation
After running the command below, what will you find in your project directory?

pytest --cov=my_module --cov-report=html
AA coverage.xml file with coverage data in XML format.
BNo files or directories are created; output is only shown in terminal.
CA coverage.txt file with plain text coverage summary.
DA directory named htmlcov containing an index.html file and other files for viewing coverage in a browser.
Attempts:
2 left
💡 Hint
HTML reports are meant to be viewed in a web browser.
Predict Output
advanced
1:30remaining
Effect of pytest coverage XML report option
What is the effect of running this command?

pytest --cov=my_module --cov-report=xml
ACreates an htmlcov directory with HTML coverage report files.
BGenerates a coverage.xml file in the current directory containing coverage data in XML format.
CDoes not generate any coverage report files.
DPrints coverage summary in the terminal only.
Attempts:
2 left
💡 Hint
XML reports are used for integration with other tools.
🧠 Conceptual
advanced
1:00remaining
Choosing coverage report formats for different needs
Which coverage report format is best suited for viewing detailed coverage information interactively in a web browser?
AHTML report format
BTerminal report format
CXML report format
DNo report format
Attempts:
2 left
💡 Hint
Think about which format uses web pages.
framework
expert
2:00remaining
Combining multiple coverage report formats in pytest
Which command correctly generates both terminal and XML coverage reports in one pytest run?
Apytest --cov=my_module --cov-report=term,xml
Bpytest --cov=my_module --cov-report=term --cov-report=xml
Cpytest --cov=my_module --cov-report=term xml
Dpytest --cov=my_module --cov-report=term+xml
Attempts:
2 left
💡 Hint
Multiple reports are separated by commas without spaces.