0
0
Selenium Pythontesting~10 mins

HTML report generation 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 HTMLTestRunner module for report generation.

Selenium Python
from [1] import HTMLTestRunner
Drag options to blanks, or click blank then click option'
Ahtmltestrunner
Bunittest
Cselenium
Dpytest
Attempts:
3 left
💡 Hint
Common Mistakes
Importing from unittest or selenium instead of htmltestrunner
Misspelling the module name
2fill in blank
medium

Complete the code to open the report file in write-binary mode.

Selenium Python
report = open('TestReport.html', '[1]')
Drag options to blanks, or click blank then click option'
Ar
Bwb
Cw
Da
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'w' instead of 'wb'
Using 'r' which is read-only mode
3fill in blank
hard

Fix the error in creating the HTMLTestRunner instance with the correct stream parameter.

Selenium Python
runner = HTMLTestRunner(stream=[1], title='Test Report', description='Sample test run')
Drag options to blanks, or click blank then click option'
Areport
Bopen
Cfile
Doutput
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the open function instead of the file object
Using an undefined variable
4fill in blank
hard

Fill both blanks to run the test suite and close the report file properly.

Selenium Python
runner.run([1])
[2].close()
Drag options to blanks, or click blank then click option'
Asuite
Btest_suite
Creport
Drunner
Attempts:
3 left
💡 Hint
Common Mistakes
Closing the runner instead of the report file
Passing wrong variable to run()
5fill in blank
hard

Fill all three blanks to create a test suite, add a test case, and generate the HTML report.

Selenium Python
suite = unittest.TestSuite()
suite.addTest([1]('test_example'))
with open('Report.html', '[2]') as [3]:
    runner = HTMLTestRunner(stream=[3], title='My Report')
    runner.run(suite)
Drag options to blanks, or click blank then click option'
AMyTestCase
Bwb
Creport
Dw
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'w' instead of 'wb' for the file mode
Not using the file object as the stream
Using wrong test case class name