亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

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

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

瀏覽:98日期: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)文章:
主站蜘蛛池模板: 久久视频在线观看免费 | 久久免费精品国产72精品剧情 | 韩国一级毛片 | 日本视频免费高清一本18 | 日韩一区二区三区免费视频 | 亚洲欧美精品一中文字幕 | 手机看片亚洲 | 看日本黄色大片 | 国产大尺度吃奶无遮无挡网 | 亚洲国产精品免费视频 | 加勒比一本一道在线 | 久久综合欧美 | 日韩久久一区二区三区 | 看真人视频一级毛片 | 午夜影院啪啪 | 国产羞羞的视频在线观看免费 | 国产精品亚洲国产三区 | 亚洲在线观看一区二区 | 欧美日韩黄色大片 | 国产成人综合日韩精品无 | 国产成人cao在线 | 色婷婷欧美| 亚洲欧美日韩闷骚影院 | 日韩欧美精品 | a毛片基地免费全部香蕉 | 婷婷色在线视频 | 自拍视频网站 | 日本特黄a级高清免费酷网 日本特黄一级 | 欧美成人四级剧情在线播放 | 免费激情网 | 欧美巨吊 | 亚洲黄毛片 | 国产在线精品观看一区 | 国产98在线传媒在线视频 | 亚洲精品亚洲人成在线 | 欧美一级毛片视频 | 欧美日韩国产亚洲人成 | 日韩经典在线 | 欧美 亚洲 国产 精品有声 | 九九精品成人免费国产片 | 中文字幕 国产 |