Complete the code to import the HTMLTestRunner module for report generation.
from [1] import HTMLTestRunner
The htmltestrunner module provides the HTMLTestRunner class used to generate HTML reports in Selenium Python tests.
Complete the code to open the report file in write-binary mode.
report = open('TestReport.html', '[1]')
Opening the report file in wb mode (write-binary) is required by HTMLTestRunner to write the HTML report correctly.
Fix the error in creating the HTMLTestRunner instance with the correct stream parameter.
runner = HTMLTestRunner(stream=[1], title='Test Report', description='Sample test run')
The stream parameter must be the file object opened for writing the report, here named report.
Fill both blanks to run the test suite and close the report file properly.
runner.run([1]) [2].close()
The test suite variable is passed to runner.run() to execute tests, and the report file object must be closed after running.
Fill all three blanks to create a test suite, add a test case, and generate the HTML report.
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)
The test case class MyTestCase is added to the suite. The report file is opened in wb mode and assigned to report which is used as the stream for the runner.