Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python HTMLTStrunner不工作_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python HTMLTStrunner不工作

Python HTMLTStrunner不工作,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我正在尝试Selenium+Python,在研究了一种生成报告的好方法之后,我遇到了“HTMLTestRunner”,问题是我在互联网上查找了很多示例,它们都是相同的,但是当我尝试让它在我的代码中工作时(主要是按play键),我看不到生成的报告,也没有任何错误,你能帮我一下吗? 这是我正在使用的代码: class TestPruebaTest(unittest.TestCase): def setUp(self): self.driver = webdriver.Fir

我正在尝试Selenium+Python,在研究了一种生成报告的好方法之后,我遇到了“HTMLTestRunner”,问题是我在互联网上查找了很多示例,它们都是相同的,但是当我尝试让它在我的代码中工作时(主要是按play键),我看不到生成的报告,也没有任何错误,你能帮我一下吗? 这是我正在使用的代码:

class TestPruebaTest(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Firefox()
        self.verificationErrors = []

    def testName(self): #Some logic on the code passing driver to another class and return
        driverUtilizoPrueba = self.driver
        manejadorLogicaBMI = logicaBMI.logicaBMI(driverUtilizoPrueba,url)
        manejadorLogicaBMI.logicaPrograma()

    def tearDown(self):
        self.driver.quit()
        self.assertEqual([], self.verificationErrors)


if __name__ == "__main__":
    suite = unittest.TestSuite()

    suite.addTest(unittest.makeSuite(TestPruebaTest))

    dateTimeStamp = time.strftime('%Y%m%d_%H_%M_%S')

    buf = file("TestReport" + "_" + dateTimeStamp + ".html", "wb")

    runner = HTMLTestRunner.HTMLTestRunner(

             stream=buf,

             title='Test the Report',

             description='Result of tests'

             )

    runner.run(suite)

安装HTMLTStrunner rv

pip安装HTMLTStrunner rv
导入时间
导入单元测试
从runner导入HTMLTestRunner
类TestPruebaTest(unittest.TestCase):
def设置(自):
打印(“设置”)
def testName(self):#将驱动程序传递给另一个类并返回
打印(“测试用例”)
def拆卸(自):
打印(“拆卸”)
如果名称=“\uuuuu main\uuuuuuuu”:
suite=unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPruebaTest))
dateTimeStamp=time.strftime(“%Y%m%d\u%H\u%m\u%S”)
runner=HTMLTestRunner(log=True,title='testthereport',
description='Result of tests',在\浏览器中打开\为真)
runner.run(套房)

当你说“按播放”时,你是指在IDE中吗?根据我自己的经验,如果从命令行运行
main
,我只会生成
html
文件,是的,很明显,这将从命令行运行,但同时我想使用IDE测试它,因为我正在为信息开发特性库。我理解这种挫折感,但我的意思是(可能还不够清楚)测试/调试html输出,即应该从命令行运行它,即使在编写代码的测试期间也是如此。