0
0
PyTesttesting~5 mins

Coverage report formats (terminal, HTML, XML) in PyTest - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a coverage report in pytest?
A coverage report shows which parts of your code were tested and which were not during test execution.
Click to reveal answer
beginner
Name three common coverage report formats supported by pytest-cov.
Terminal (text output), HTML (interactive web pages), and XML (machine-readable format).
Click to reveal answer
beginner
How do you generate an HTML coverage report using pytest?
Run pytest with the option: --cov-report=html. This creates a folder named 'htmlcov' with the report files.
Click to reveal answer
intermediate
What is the benefit of an XML coverage report?
XML reports can be used by other tools like CI servers to analyze coverage automatically.
Click to reveal answer
beginner
What does the terminal coverage report show?
It shows a summary of coverage percentages and which lines were missed directly in the command line.
Click to reveal answer
Which pytest-cov option generates an HTML coverage report?
A--cov-report=html
B--cov-report=xml
C--cov-report=term
D--cov-html
What folder is created by default when generating an HTML coverage report?
Acoverage_report
Bcoverage_html
Ccov_html
Dhtmlcov
Which coverage report format is best for automated tools and CI servers?
AXML
BHTML
CPDF
DTerminal
What does the terminal coverage report NOT provide?
ASummary of coverage percentages
BList of missed lines
CInteractive clickable links
DCoverage data in text form
Which command shows coverage summary directly in the terminal?
Apytest --cov-report=xml
Bpytest --cov-report=term-missing
Cpytest --cov-report=html
Dpytest --cov-report=term
Explain the differences between terminal, HTML, and XML coverage reports in pytest.
Think about who uses each format and how.
You got /3 concepts.
    Describe how to generate and view an HTML coverage report using pytest.
    Remember the folder name and how to open the report.
    You got /3 concepts.