0
0
Selenium Pythontesting~10 mins

Test reporting in CI in Selenium Python - Interactive Code Practice

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

Complete the code to import the module used for generating test reports in pytest.

Selenium Python
import [1]
Drag options to blanks, or click blank then click option'
Apytest_html
Bselenium
Cunittest
Dlogging
Attempts:
3 left
💡 Hint
Common Mistakes
Importing selenium instead of pytest_html
Using unittest which does not generate HTML reports by default
2fill in blank
medium

Complete the pytest command to generate an HTML report named 'report.html'.

Selenium Python
pytest --html=[1]
Drag options to blanks, or click blank then click option'
Aresults.json
Boutput.txt
Clog.xml
Dreport.html
Attempts:
3 left
💡 Hint
Common Mistakes
Using a .txt or .json file extension which is not HTML
Omitting the file name
3fill in blank
hard

Fix the error in the pytest fixture that adds environment info to the HTML report.

Selenium Python
@pytest.hookimpl(optionalhook=True)
def pytest_configure(config):
    config._metadata[[1]] = 'Chrome 114'
Drag options to blanks, or click blank then click option'
Abrowser
B'browser'
C'Browser'
DBrowser
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted identifiers causing syntax errors
Using lowercase key names that don't match expected metadata keys
4fill in blank
hard

Fill both blanks to add a custom environment info and remove default metadata in pytest HTML report.

Selenium Python
def pytest_configure(config):
    config._metadata.pop([1], None)
    config._metadata[[2]] = 'QA Team'
Drag options to blanks, or click blank then click option'
A'JAVA_HOME'
B'Python Version'
C'Tester'
D'JAVA_HOME_PATH'
Attempts:
3 left
💡 Hint
Common Mistakes
Using keys without quotes
Removing or adding wrong metadata keys
5fill in blank
hard

Fill all three blanks to configure pytest to generate an HTML report, save logs, and set verbosity.

Selenium Python
pytest.main(['--html=[1]', '--self-contained-html', '--log-file=[2]', '-[3]'])
Drag options to blanks, or click blank then click option'
Areport.html
Btest.log
Cv
Dq
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-q' which reduces output instead of '-v'
Using wrong file extensions for report or log files