当前位置:网站首页>4、 Testfixture test fixture, or test firmware
4、 Testfixture test fixture, or test firmware
2022-07-25 10:21:00 【Christmas gift box】
Use case files ecshop_login.py:
import os
import unittest
from my_unit import MyUnit
class EcshopLogin(MyUnit):
# The test case
def test01_xiaoming(self):
print(" Test Xiao Ming ")
# The test case
def test02_weiwei(self):
print(" Test Pico ")
# The test case
def test10_xiaohongi(self):
print(" Test Xiaohong ")
class Test2(unittest.TestCase):
def test_login(self):
print(" Test login ")Fixture package file my_unit.py:
import unittest
class MyUnit(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
print("setUpClass: Execute once before each class . Such as : Create database , Generate log object ")
def setUp(self):
print("\nsetUp: Preparation before test cases , Such as : Open the browser , Load web page ")
def tearDown(self):
print("tearDown: Unfinished work after test cases , Such as : Close the browser ")
@classmethod
def tearDownClass(cls) -> None:
print("tearDownClass: Execute once after each class . Such as : Close database connection , Destroy log object ")
Run the file all.py:
import os
import unittest
if __name__ =='__main__':
suite = unittest.TestSuite()
testcase = unittest.defaultTestLoader.discover(start_dir=os.getcwd(),pattern='*.py')
suite.addTests(testcase)
unittest.main(defaultTest='suite')
#unittest.TextTestRunner().run(suite) There is no difference between the results of the two calling methods 边栏推荐
猜你喜欢

js加密参数定位

Angr(九)——angr_ctf

JS encryption parameter positioning

VS Code 连接远程 Jupyter 服务器

UE4 框架介绍

Duplicate SSL_ Anti spoofing, spoofing attacks and deep forgery detection using wav2vec 2.0 and data enhanced automatic speaker authentication

Angr (VII) -- angr_ ctf

史上最全面的UE4 文件操作,打开,读、写,增、删、改、查

Angr (VIII) -- angr_ ctf

mysql 解决不支持中文的问题
随机推荐
一文学会,三款黑客必备的抓包工具教学
部署主从数据库
Simple addition calculator
FRP reverse proxy deployment
File upload function
简易加法计算器
[untitled]
Pow(x,n)
struct2的原理
Ubuntu20.04系统下安装MySQL数据库5.7.29版本
js加密参数定位
Summary of most consistency problems
Angr (VIII) -- angr_ ctf
Erlang(离线部署)
Number theory -- Research on divisor
Redis使用场景
安装mysql时,string the service 安装失败>mysql80启动失败
数论--负进制转换
Angr (V) - angr_ ctf
JS encryption parameter positioning