Bird
0
0

Examine this Selenium Python unittest code snippet using HtmlTestRunner. What is the error?

medium📝 Debug Q6 of 15
Selenium Python - Test Framework Integration (pytest)
Examine this Selenium Python unittest code snippet using HtmlTestRunner. What is the error?
import unittest
import HtmlTestRunner

class SampleTest(unittest.TestCase):
    def test_check(self):
        self.assertTrue(True)

suite = unittest.TestLoader().loadTestsFromTestCase(SampleTest)
runner = HtmlTestRunner.HTMLTestRunner(output='reports')
runner.run(suite
AHtmlTestRunner does not support unittest framework
BThe output folder 'reports' must be an absolute path
CThe runner.run(suite) call is incomplete and missing a closing parenthesis
DThe test method name should start with 'test_'
Step-by-Step Solution
Solution:
  1. Step 1: Review code syntax

    The last line 'runner.run(suite' is missing a closing parenthesis.
  2. Step 2: Validate other options

    Output folder can be relative, HtmlTestRunner supports unittest, and method name is correct.
  3. Final Answer:

    The runner.run(suite) call is incomplete and missing a closing parenthesis -> Option C
  4. Quick Check:

    Check for syntax completeness [OK]
Quick Trick: Always close parentheses in method calls [OK]
Common Mistakes:
  • Assuming output folder must be absolute path
  • Believing HtmlTestRunner is incompatible with unittest
  • Ignoring syntax errors like missing parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes