Failed to generate RESULT REPORT

this is my code
I don"t know how to open file
or it may not be generated at all
busy
busy

from selenium import webdriver
import unittest, time
import HTMLTestRunner
class MyTest(unittest.TestCase):
def setUp(self):
    self.driver = webdriver.Chrome()
    self.driver.maximize_window()
    self.driver.implicitly_wait(10)
    self.base_url = "http://www.baidu.com"


def test_baidu(self):
    driver = self.driver
    driver.get(self.base_url + "/")
    driver.find_element_by_id("kw").clear()
    driver.find_element_by_id("kw").send_keys("HTMLTestRunner")
    driver.find_element_by_id("su").click()


def tearDown(self):
    self.driver.quit()


if __name__ == "__main__":
    testSuite = unittest.TestSuite()
    testSuite.addTest(MyTest("test_baidu"))
    Html = ".\\result.htm"
    fp = file(Html, "wb")

    runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title=u"", description=u":")
    runner.run(testSuite)
    fp.close()

Some help please with my code to generate the html report.

Thanks, Chris


1. First of all, there is something wrong with your indentation. The def xxx under class should be indented. Why don't you have any? I don't know if you copied it or not.
2. You need to run a single .py file to generate a html report. You can refer to the article I wrote about this not long ago: https://codeshelper.com/a/11.
. Oh, by the way, I compiled it with the pycharm tool.

Menu