随笔分类 - Pytest
摘要:一、pytest的简介1、pytest是一个非常成熟的python的单元测试框架,比unittest更加灵活,容易上手。2、pytest可以和selenium,requests,appium结合实现web自动化,接口自动化,app自动化。3、pytest可以实现测试用例的跳过以及reruns失败用例
阅读全文
摘要:Pytest-html 1、安装命令pip3 install pytest-html,如下图: 执⾏后,会在当前⽬录下⽣成 ⼀个report.html的⽂件,打开后会展示详细的测试报告,执行该命令python -m pytest tests/ --html=report/index.html 将会在
阅读全文
摘要:安装pytest,先打开cmd-->输入命令pip3 install pytest,回车 创建一个unitApi文件夹,在文件夹下面创建一个test_add.py,代码如下: def add(a,b): return a+b def test_add_001(): assert add(1,1)==
阅读全文
摘要:Pytest中的fixture fixture返回值 : fixture是在测试函数运⾏前后。比如在一个登录系统中,登录成功后,会返回一个token。fixture返回值的案例,代码如下: #tests包下的test_fixture.py代码import pytest @pytest.fixture
阅读全文
摘要:安装pytest,先打开cmd-->输入命令pip3 install pytest,回车 创建一个unitApi文件夹,在文件夹下面创建一个test_add.py,代码如下: def add(a,b): return a+b def test_add_001(): assert add(1,1)==
阅读全文
浙公网安备 33010602011771号