当前位置:网站首页>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'])
运行结果
边栏推荐
- 2021-08-12 function recursion_ Learn C language with brother Peng
- 企鹅龙(DRBL)无盘启动+再生龙(clonezilla)网络备份与还原系统
- C language pengge 20210812c language function
- 1837.K进制表示下的各位数字总和
- Definition and use of C language namespace
- 0x00007FFD977C04A8 (Qt5Sqld.dll)处(位于 a.exe 中)引发的异常: 0xC0000005: 读取位置 0x0000000000000010 时发生访问冲突
- Sql Server 数据库之初学体验
- Bash shell学习笔记(三)
- 如何组装一个注册中心?
- c 语言中宏参数的字符串化跟宏参数的连接
猜你喜欢

二叉树的遍历 递归+迭代
![[leetcode daily question 2021/5/8]1723. The shortest time to complete all work](/img/e7/a48bb5b8a86cbc4cd5b37bb16661a8.png)
[leetcode daily question 2021/5/8]1723. The shortest time to complete all work

$router和$route的区别
![Error[pe147]: declaration is incompatible with 'error problem](/img/4f/57145d78f4dc1fe84d2f271dd9d82f.png)
Error[pe147]: declaration is incompatible with 'error problem

RT thread learning notes (III) -- building a compilation environment with scons

Many people don't know whether they are looking for Kanban software or Kanban software

母亲

Linkedblockingqueue of novice source code

ThreadPoolExecutor是怎样执行任务的

SCADA和三大工业控制系统PLC、DCS、FCS
随机推荐
232. Implement queue with stack
349. 两个数组的交集
2021-08-12 function recursion_ Learn C language with brother Peng
[leetcode daily question 2021/8/31] 1109. Flight reservation statistics [medium] differential array
@Notblank, @notnull, @notempty differences and uses
Implementing queues with two stacks
11 handle "self assignment" in operator=
Pengge C language sixth class
MFC多线程的简单使用
C#halcon用户控件崩溃的一种处理方法
构建ARM嵌入式开发环境
Sword finger offer (53): a string representing a numeric value
MFC中0x003b66c3 处有未经处理的异常: 0xC000041D: 用户回调期间遇到未经处理的异常
Drbl diskless startup + Clonezilla network backup and restore system
20210807 1 c language program structure
27.移除元素
Bash shell学习笔记(四)
232.用栈实现队列
[leetcode daily question 2021/4/23]368. Maximum divisible subset
Sword finger offer (twenty): stack containing min function