当前位置:网站首页>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'])
运行结果
边栏推荐
- RT thread learning notes (VIII) -- start the elmfat file system based on SPI flash (Part 2)
- Flutter jni混淆 引入.so文件release包闪退
- Shell script fails to execute repeatedly automatically
- 349. 两个数组的交集
- 使用grid实现左中右布局,中间内容自适应
- Sword finger offer (8): jump the steps
- Add touch screen driver for stemwin 5.22 on Shenzhou IV development board
- Esxi6.5 patch update
- 菜鸟看源码之HashTable
- Flutter TextField设置高度并且自动换行,圆角边框去除下划线
猜你喜欢

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

按二进制数中1的个数分类

Bash shell学习笔记(一)

20210807 1 c language program structure
![[leetcode daily question 2021/4/29]403. Frogs cross the river](/img/fb/612777c77df5a611506e72f4f4c3c8.png)
[leetcode daily question 2021/4/29]403. Frogs cross the river

Kali view IP address
![[leetcode daily question 2021/8/31] 1109. Flight reservation statistics [medium] differential array](/img/9d/5ce5d4144a9edc3891147290e360d8.png)
[leetcode daily question 2021/8/31] 1109. Flight reservation statistics [medium] differential array

Bash shell学习笔记(二)

RT thread learning notes (VI) -- start the elmfat file system based on SPI flash (Part 1)

@NotBlank、@NotNull 、@NotEmpty 区别和使用
随机推荐
@Validated 和 @Valid 的真正区别和使用方式
[dectectron2] follow the official demo
Flutter 防止科学计数并去除尾数无效0
智能合约dapp系统开发流程技术
Sql Server 之SQL语句对基本表及其中的数据的创建和修改
$router和$route的区别
【小程序】onReachBottom 事件为什么不能触发 ?(一秒搞定)
SQL Server 之Sql语句创建数据库
Codepoint 58880 not found in font, aborting. flutter build apk时报错
router.push(),router.repalce(),router.go()使用
Build ARM embedded development environment
C#委托与匿名方法浅析
Fragment 懒加载
Wechat official account message notice "errCode": 40164, "errmsg": "invalid IP
微信公众号开发 获取openid时报错40029 invalid code 问题的解决
对面向抽象编程的理解
[leetcode daily question 2021/2/13]448. Find all the missing numbers in the array
MFC多线程的简单使用
display-inline+calc实现左中右布局,中间自适应
使用flex实现左中右布局,中间自适应