随笔分类 -  Pytest

Pytest相关知识
摘要:##Fixture 报错机制: ###pytest does its best to put all the fixtures for a given test in a linear order so that it can see which fixture happens first, sec 阅读全文
posted @ 2021-04-28 14:07 Hei蛋炒饭 阅读(112) 评论(0) 推荐(0) 编辑
摘要:##Fixture用法4: ##一个测试用例/Fixture,可以同时调用多个其他的fixture Tests and fixtures aren’t limited to requesting a single fixture at a time. They can request as many 阅读全文
posted @ 2021-04-21 14:10 Hei蛋炒饭 阅读(89) 评论(0) 推荐(0) 编辑
摘要:##Fixture用法1: ##当做参数传入测试方法中 先看官方文档的示例代码: import pytest class Fruit: def __init__(self, name): self.name = name def __eq__(self, other): return self.na 阅读全文
posted @ 2021-03-27 14:48 Hei蛋炒饭 阅读(170) 评论(0) 推荐(0) 编辑
摘要:从12月开始一直在忙着做公司旧自动化框架的改造 原来的框架使用Unittest+htmlrunner来作为测试框架,并且部分测试用例没有使用数据驱动封装,有部分又是使用了数据驱动【excel来进行用例管理】 和领导沟通后,这2个月与另外一位同事投了一半的时间来进行框架的重构及用例的改造 目录树及用途 阅读全文
posted @ 2021-01-27 15:57 Hei蛋炒饭 阅读(323) 评论(0) 推荐(0) 编辑
摘要:@allure.feature @allure.story allure支持用户对测试用例进行功能模块的自定义,并展示在报告中 需要在测试用例代码中加上装饰器**@allure.feature【加在测试类上】****@allure.story【加在测试用例(方法)中】** 代码如下图: 当我们执行用 阅读全文
posted @ 2020-08-15 11:32 Hei蛋炒饭 阅读(608) 评论(0) 推荐(0) 编辑
摘要:在我们使用pytest-allure生成测试报告时,需要分为以下几步来执行 1、pytest TestCal.py --alluredir=/tmp/my_allure_results【这一步,是设置pytest运行TestCal.py中的测试用例,并生成测试数据到指定到命令后面配置的文件夹中】 如 阅读全文
posted @ 2020-08-15 10:40 Hei蛋炒饭 阅读(500) 评论(0) 推荐(0) 编辑
摘要:**在使用pytest做测试的过程中,经常会用到pytest.mark.parametrize来对批量生成测试用例,比如** @pytest.mark.parametrize( ['a', 'b', 'expect'], [ (1, 2, 3), (2, 2, 4), (3, 2, 5) ]) de 阅读全文
posted @ 2020-08-14 22:36 Hei蛋炒饭 阅读(2067) 评论(1) 推荐(2) 编辑

点击右上角即可分享
微信分享提示