问题描述:

I'm giving it a try to Selenium+Python and after having researched a little bit about a nice way to generate a report I run into "HTMLTestRunner", the thing is that I've looked for a lot of examples on the internet and they're all the same however when I try to get it to work on my code (pressing play mostly), I can't see the report generated and I'm not getting any error , Can you giving me a hand please?

This is the code I'm using:

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)

相关阅读:
Top