国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

為什么python+htmltestrunner生成的測(cè)試報(bào)告有問(wèn)題?

瀏覽:106日期:2022-08-29 08:18:37

問(wèn)題描述

問(wèn)題:一個(gè)百度首頁(yè)搜索的一個(gè)python+unittest測(cè)試,代碼執(zhí)行成功,但是用HTMLTestRunner輸出的測(cè)試報(bào)告里面得內(nèi)容有問(wèn)題,具體問(wèn)題是:測(cè)試條數(shù),成功數(shù),失敗數(shù)都為0代碼

?# -*- coding: utf-8 -*-from selenium import webdriverimport osimport timeimport unittestimport reimport HTMLTestRunnerfrom selenium.webdriver.support.wait import WebDriverWaitfrom selenium.webdriver.support import expected_conditionsfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support.ui import Selectfrom selenium.common.exceptions import NoSuchElementExceptionfrom selenium.common.exceptions import NoAlertPresentExceptionclass LoginBaiDu(unittest.TestCase): def setUp(self):self.driver = webdriver.Chrome()self.driver.implicitly_wait(30)self.base_url = 'http://www.baidu.com'self.verificationErrors = []self.accept_next_alert = Trueprint(’Done-01’) def test_baidu(self):self.driver.get(self.base_url)self.driver.find_element_by_id('su').click()print(’Done-02’)time.sleep(2)jsClear='$('input[id=’kw’]').val('')'self.driver.execute_script(jsClear)print(’Done-03’)time.sleep(2)jsVal='$('input[id=’kw’]').val('selenium+python')'self.driver.execute_script(jsVal)time.sleep(1)self.driver.find_element_by_xpath('//input[@id=’su’]').click()print(’Done-04’)self.driver.close()print(’Done-05’) def tearDown(self):self.driver.quit()self.assertEqual([], self.verificationErrors)print('test down...') if __name__=='__main__':test=unittest.TestSuite()test.addTest(setUp)test.addTest(test_baidu)file_path='D:workspacePythonLearnsrcLoginBaiDuresult.html'file_result=open(file_path,’wb’)runner=HTMLTestRunner.HTMLTestRunner(stream=file_result,title=u'百度首頁(yè)測(cè)試',description=u'用例執(zhí)行情況')runner.run(test)file_result.close()

生成的報(bào)告截圖:為什么python+htmltestrunner生成的測(cè)試報(bào)告有問(wèn)題?

問(wèn)題解答

回答1:

加測(cè)試用例的方式錯(cuò)了要test=unittest.TestSuite() test.addTest(LoginBaiDu(’setUp’))test.addTest(LoginBaiDu(’test_baidu’))

或者直接加入類test= unittest.TestLoader().loadTestsFromTestCase(LoginBaiDu)

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 日韩经典在线观看 | 精品国产自在现线看久久 | 九九99九九在线精品视频 | 免费久久精品视频 | 67194午夜| 手机在线亚洲 | 国产手机看片 | 永久天堂 | 欧美久久亚洲精品 | 日本特黄特色大片免费视频网站 | 日本aaaa级毛片在线看 | 九九这里只精品视在线99 | 好叼操这里只有精品 | 性感美女一级片 | 无限资源中文免费 | 黄毛片一级毛片 | 国产综合精品久久亚洲 | 日韩欧免费一区二区三区 | 在线观看日本永久免费视频 | 中国一级毛片免费观看 | 欧美一区二区在线观看视频 | 在线视频一二三区2021不卡 | 成人做爰视频www片 成人做爰视频www视频 | 女人张开腿让男人桶视频 | 成人亚洲精品一区二区 | 日本免费观看的视频在线 | 精品国产乱码久久久久久一区二区 | 在线中文字幕精品第5页 | 特级aaaaaaaaa毛片免费视频 | 在线观看毛片视频 | 看一级毛片一区二区三区免费 | 5x性区m免费毛片视频看看 | 一级毛片真人免费观看 | 日本 亚洲 欧美 | 成人免费毛片视频 | 欧美最猛性xxxxx亚洲精品 | 久久国产精品99久久小说 | 亚洲欧美日本在线 | 在线视频自拍 | 波多野结衣中文视频 | 在线人成精品免费视频 |