Bird
0
0

You want to generate an HTML report that shows detailed pass/fail results and saves in a folder named 'test_reports'. Which code snippet correctly sets this up using HtmlTestRunner with unittest?

hard📝 framework Q15 of 15
Selenium Python - Test Framework Integration (pytest)
You want to generate an HTML report that shows detailed pass/fail results and saves in a folder named 'test_reports'. Which code snippet correctly sets this up using HtmlTestRunner with unittest?
Aunittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='test_reports'))
Bunittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(report='test_reports'))
Cunittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(folder='test_reports'))
Dunittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(path='test_reports'))
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct parameter for output folder

    HtmlTestRunner uses 'output' parameter to specify the folder for saving reports.
  2. Step 2: Check other parameter names

    'report', 'folder', and 'path' are not valid parameters for HtmlTestRunner's HTMLTestRunner class.
  3. Final Answer:

    unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='test_reports')) -> Option A
  4. Quick Check:

    Use output='foldername' to save reports correctly [OK]
Quick Trick: Use output='foldername' to set report save location [OK]
Common Mistakes:
  • Using wrong parameter names like report or folder
  • Not specifying output folder at all
  • Confusing HtmlTestRunner options with other packages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes