当前位置:网站首页>Generating test reports using the unittest framework
Generating test reports using the unittest framework
2022-06-21 17:01:00 【Expert of explosive liver fist】
Generate test reports
Case code :
Testcase.py file :
import unittest
class Test_case(unittest.TestCase)# Inherit TestCase class :
# start
def setUp(self):
print(' All use case execution starts !!!')
# end
def tearDown(self):
print(' All use case execution ends !!!')
def test_ab(self):
print('ab Use case execution -------')
a = 1
b = 1
# Judge by assertion a And b Whether it is equal or not
self.assertEqual(a,b,'a And b identical ')
def test_cd(self):
c=7
d=1
print('cd Use case execution --------')
self.assertEqual(c,d,'c And d atypism ')
Testsuit.py file :
import unittest
from HTMLTestRunner import HTMLTestRunner
from AA.Testcase import Test_case
# Construct test suite ( Test flow )
testsuite=unittest.TestSuite()
# Add test case
testsuite.addTest(Test_case('test_ab'))# call Test_case Class test_ab Method
testsuite.addTest(Test_case('test_cd'))# call Test_case Class test_cd Method
# establish report.html Test report
file=open('./report.html','wb')
runner=HTMLTestRunner(stream=file,title=' Test report ',description=' Perform the report ')
runner.run(testsuite)
file.close()
Generated test report :
边栏推荐
- Wise people: three no's, four no's and five no's, the ancient way of dealing with people
- Implementation and landing of any to any real-time voice change RTC dev Meetup
- 使用unittest框架生成测试报告
- Web page automation practice "1. use the PY third-party library selenium to complete the access operation of elong"
- 微信小程序开发入门教程-文本组件介绍
- 之前的装机记录
- 鲁班会开发者深度论坛丨与成都伙伴一起 “洞见物联网新风潮”
- Any to Any 实时变声的实现与落地丨RTC Dev Meetup
- Huawei cloud releases desktop ide codearts
- 海外new things | 美国人工智能初创「Zoovu」新一轮融资1.69亿美元,为消费者优化线上的“产品发现”体验
猜你喜欢
随机推荐
Growth is not necessarily related to age
Disruptor local thread queue_ Workprocessor exception_ Fatalexceptionhandler--- inter thread communication work note 004
机器学习模型监控(Aporia)
Daily appointment queue assistant | user manual
Focusing on industrial intelligence scenarios, Huawei cloud recruits partners to help solve transformation problems
如何判断DNS解析故障?如何解决DNS解析错误?
实战---商场登录测试
Web page automation practice "3. in elong, hotels are accurately matched according to city + date + keyword" part 2
深入理解零拷贝技术
About SQL: does anyone in SQL know how to answer these questions?
期货农产品开户怎么开?手续费是多少?
In 2022, the number of mobile banking users in Q1 will reach 650million, and ESG personal financial product innovation will be strengthened
阿里云服务器+宝塔面板+无域名部署web项目
Web page automation practice "1. use the PY third-party library selenium to complete the access operation of elong"
Yaml数据驱动演示
Google Earth Engine(GEE)——sentinel-1综合查看两个月前后自动滑坡监测,两者之间的差异(危地马拉为例)
[从零开始学习FPGA编程-38]:进阶篇 -语法-函数与任务
How to write test cases
我敢闯 我会创!第八届“互联网 +”大赛GaussDB命题开放报名啦!
I do 3D restoration for the aircraft carrier: these three details are shocking








