Pytest
从0学习之路
Anouk
在测试道路上前行的菜鸟!
展开
-
Pytest学习(三)- 前置和后置setup、teardown
用例运行级别 模块级(setup_module/teardown_module)开始于模块始末,全局的 函数级(setup_function/teardown_function)只对函数用例生效(不在类中) 类级(setup_class/teardown_class)只在类中前后运行一次(在类中) 方法级(setup_method/teardown_method)开始于方法始末(在类中) 类里面的(setup/teardown)运行在调用方法的前后 函数式原创 2021-03-11 16:48:24 · 148 阅读 · 0 评论 -
Pytest学习(二)- pycharm运行pytest
1.以pytest方式运行,需要运行该设置默认的运行器:file->Setting->Tools->Pythonintegrated Tools->原创 2021-03-09 23:11:18 · 132 阅读 · 0 评论 -
Pytest学习(一)- 入门及基础
一、安装pytest pipinstall-Upytest 二、快速入门 示例代码如下: # coding: utf-8 def add(x): return x + 2; class TestClass(object): # 测试是否相等 def test_add(self): assert add(2) == 5 # 测试包含 def test_in(self): a = 'hello world' ...原创 2020-11-07 17:19:25 · 169 阅读 · 0 评论