from selenium import webdriver
import unittest
from HTMLTestRunner import HTMLTestRunner
class Baidu(unittest.TestCase):
def setUp(self):
self.driver=webdriver.Firefox()
self.driver.implicitly_wait(10)
self.base_url=“http://www.baidu.com”
def test_baidu_search(self):
driver=self.driver
driver.get(self.base_url)
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”:
testunit = unittest.TestSuite()
testunit.addTest(Baidu(“test_baidu_search”))
print “abc”
fp = open("./result.html",‘wb’)
runner = HTMLTestRunner(stream=fp,title=‘baidushous’,description=‘testcase’)
runner.run(testunit)
fp.close();
如果对软件测试、接口测试、自动化测试、持续集成、面试经验。感兴趣可以进到806549072,群内会有不定期的分享测试资料。还会有技术大牛,业内同行一起交流技术
python生成自动化测试报告
最新推荐文章于 2024-07-19 16:26:45 发布