allure和pytest的简单使用

# -*- coding: utf-8 -*-
# 2022/1/14

import pytest
import allure
import os

@allure.feature("登录模块")
class TestLogin:
    #allure报告层级
    @allure.story("登录操作")
    @allure.title("login1")
    #数据驱动
    @pytest.mark.parametrize(['a','b'],[(1,2),(2,2),(5,6)])
    def test_login1(self,a,b):
        assert a == b-1

    @allure.story("销售操作")
    @allure.title("give1")
    @pytest.mark.parametrize(['a','b'], [(1, 2), (2, 2),(5,6)])
    def test_login2(self,a,b):
        assert a == b
#pytest结合allure报告,把allure的bin文件夹放到path路径内
#pip install allure-pytest
if __name__ == '__main__':
    #allure报告数据存放路径
    pytest.main(["test_123.py","-s","--alluredir","./report/tmp"])
    #运行源数据,生成操作,报告存放目录,每次运行删除上一次的数据
    os.system("allure generate ../report/tmp -o ./report/report  --clean")

#接口测试工具,postman,jmeter,soapui
#pip show pytest查看pytest下载成功
#接口测试类,pytest,unitest,nose,rf,
#pytest比unitest效率高,定制化,兼容unitest,支持多插件
#1.测试类以Test开头。没有init函数
#2.python文件以test_开头
#3.函数以test_开头
#4.断言使用assert
#lib文件夹存放源码,data文件夹存放数据文件,test_case文件夹存放测试用例脚本
#report文件夹存放报告文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值