怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告-創(chuàng)新互聯(lián)

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

成都創(chuàng)新互聯(lián)主要從事成都網(wǎng)站建設(shè)、成都做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)南寧,10多年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):18980820575

目錄如下:

怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告

這里有使用

HTMLTestRunner和 echarts.common.min.js文件[見百度網(wǎng)盤,這里給自己留個(gè)記錄便于查詢]

unit_test.py代碼如下:

import unittest
import requests
import time
import os.path
from common import HTMLTestRunner
 
 
class TestLogin(unittest.TestCase):
 
 def setUp(self):
  # 獲取session對(duì)象
  self.session = requests.session()
  # 登錄url
  self.url = 'http://XXXXXX/oauth/oauth/token'
 
 def test_login_success(self):
  data = {
   'grant_type': 'password',
   'username': 'iu',
   'password': '111',
   'client_id': 'web',
   'client_secret': 'web-secret'
  }
  r = self.session.post(url=self.url, data=data)
  try:
   self.assertEqual(r.json()['token_type'])
  except AssertionError as e:
   print(e)
  
 
 def test_username_not_exit(self):
  data = {
   'grant_type': 'password',
   'username': '322u',
   'password': '8',
   'client_id': 'web',
   'client_secret': 'web-secret'
  }
  r = self.session.post(url=self.url, data=data)
  try:
   self.assertEqual("用戶名或密碼錯(cuò)誤", r.json()["error_description"])
  except AssertionError as e:
   print(e)
 
 def test_password_error(self):
  data = {
   'grant_type': 'password',
   'username': '2u',
   'password': '888ssss888',
   'client_id': 'web',
   'client_secret': 'web-secret'
  }
  r = self.session.post(url=self.url, data=data)
  try:
   self.assertEqual("用戶名或密碼錯(cuò)誤", r.json()["error_description"])
  except AssertionError as e:
   print(e)
 
 def tearDown(self):
  self.session.close()
 
 
if __name__ == '__main__':
 # unittest.main()
 test = unittest.TestSuite()
 test.addTest(TestLogin('test_login_success'))
 test.addTest(TestLogin('test_username_not_exit'))
 test.addTest(TestLogin('test_password_error'))
 
 rq = time.strftime('%Y%m%d%H%M', time.localtime(time.time()))
 file_path = os.path.abspath('.') + '\\report\\' + rq + '-result.html'
 
 file_result = open(file_path, 'wb')
 
 runner = HTMLTestRunner.HTMLTestRunner(stream=file_result, title=u'測(cè)試報(bào)告', description=u'用例執(zhí)行情況')
 runner.run(test)
 file_result.close()

運(yùn)行產(chǎn)生報(bào)告怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告查看報(bào)告:

怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告

上述就是小編為大家分享的怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

網(wǎng)頁(yè)標(biāo)題:怎么在python中使用HTMLTestRunner導(dǎo)出餅圖分析報(bào)告-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://muchs.cn/article18/pcodp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、移動(dòng)網(wǎng)站建設(shè)、網(wǎng)站策劃外貿(mào)網(wǎng)站建設(shè)、搜索引擎優(yōu)化、網(wǎng)站維護(hù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)