0
0
PyTesttesting~10 mins

Coverage report formats (terminal, HTML, XML) in PyTest - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run pytest with coverage and show the report in the terminal.

PyTest
pytest --cov=my_package --cov-report=[1]
Drag options to blanks, or click blank then click option'
Ajson
Bhtml
Cxml
Dterm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html' or 'xml' instead of 'term' for terminal output.
Forgetting to add --cov-report option.
2fill in blank
medium

Complete the code to generate an HTML coverage report in the 'coverage_html' folder.

PyTest
pytest --cov=my_package --cov-report=[1]:coverage_html
Drag options to blanks, or click blank then click option'
Axml
Bterm
Chtml
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'term' or 'xml' instead of 'html' for HTML report.
Not specifying the output folder after colon.
3fill in blank
hard

Fix the error in the code to generate an XML coverage report named 'coverage.xml'.

PyTest
pytest --cov=my_package --cov-report=[1]:coverage.xml
Drag options to blanks, or click blank then click option'
Axml
Bterm
Chtml
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html' or 'term' instead of 'xml' for XML report.
Not specifying the file name after colon.
4fill in blank
hard

Fill both blanks to generate terminal and HTML coverage reports simultaneously.

PyTest
pytest --cov=my_package --cov-report=[1] --cov-report=[2]:htmlcov
Drag options to blanks, or click blank then click option'
Aterm
Bhtml
Cxml
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same format twice.
Mixing up the order of reports.
5fill in blank
hard

Fill all three blanks to generate terminal, HTML, and XML coverage reports.

PyTest
pytest --cov=my_package --cov-report=[1] --cov-report=[2]:htmlcov --cov-report=[3]:coverage.xml
Drag options to blanks, or click blank then click option'
Aterm
Bhtml
Cxml
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect format names.
Not specifying output paths for HTML and XML reports.