当前位置:网站首页>pytest 前后置方法
pytest 前后置方法
2022-07-26 10:50:00 【亚索不会吹风】
代码
import pytest
class TestFrontBack:
def setup_class(self):
print("前置条件(作用域:每个类执行之前):创建日志对象,创建数据库连接")
def setup(self):
print("前置条件(作用域:每个用例执行之前):打开谷歌,窗口最大化")
def test_login(self):
print('点击登录')
print('输入账号')
print('输入密码')
print('点击登录')
def test_buy(self):
print('登录界面输入账号密码')
print('点击登录')
print('查看商品加入购物车')
print('购物车购买支付商品')
print('查看账户余额')
def teardown(self):
print('后置条件(作用域:每个用例执行之前后):关闭谷歌')
def teardown_class(self):
print('后置条件(作用域:每个类执行之前后):销毁日志对象,销毁数据库连接')
if __name__ == '__main__':
pytest.main([r'D:\python新代码集\pytest_study\basics\test_front_back.py'])
运行结果
边栏推荐
猜你喜欢

Why do I need automated testing? Software testers take you to evaluate different software testing tools

242.有效的字母异位词

很多人都不清楚自己找的是Kanban软件还是看板软件

菜鸟看源码之LinkedBlockingQueue

The problem of formatting IAR sprintf floating point to 0.0 in UCOS assembly

RT thread learning notes (V) -- edit, download and debug programs

SCADA和三大工业控制系统PLC、DCS、FCS

2021-08-12 function recursion_ Learn C language with brother Peng

Capture ZABBIX performance monitoring chart with selenium

Software Testing Overview: the background, essence and process of software testing
随机推荐
Sql Server 之SQL语句对基本表及其中的数据的创建和修改
104. Maximum depth of binary tree
Wireshark basic tutorial Ethernet frame analysis.
[leetcode daily question 2021/5/8]1723. The shortest time to complete all work
Common classes (understand)
Sword finger offer (twenty): stack containing min function
对面向抽象编程的理解
242.有效的字母异位词
Sword finger offer (43): left rotation string
shell 脚本 失败自动重复执行
[leetcode daily question 2021/2/18] [detailed explanation] minimum number of turns of 995. K continuous bits
C#委托与匿名方法浅析
Fragment lazy load
C语言命名空间的定义与使用
Kali view IP address
微信公众号消息通知 “errcode“:40164,“errmsg“:“invalid ip
Sword finger offer (twenty): stack containing min function
Esxi6.5 patch update
Software Testing Overview: the background, essence and process of software testing
SparseArray of the source code for novices