linux下jenkins+pytest+allure

创建pytest测试用例

test_allure_demo.py

import allure
import pytest

@pytest.fixture(scope="session")
def login():
    print("用例先登录")

@allure.step("步骤1")
def step_1():
    print("111")

@allure.step("步骤2")
def step_2():
    print("222")

@allure.feature("编辑页面")
class TestEditPage():
    '''编辑页面'''

    @allure.story("这是一个xxxx用例")
    def test_1(self,login):
        step_1()
        step_2()
        print("xxxxx")

    @allure.story("这是一个yyy用例")
    def test_2(self,login):
        print("yyy")

并上传至linux服务器
/home/software/python-workspace/pytest-0904

构建jenkins

在这里插入图片描述
注意:前面必须要加上#!/bin/sh -l,不然会找不到pytest命令,同时可以给pytest配置软链接,ln -s /opt/python36/bin/pytest /usr/bin/,/opt/python36为python的安装目录

在这里插入图片描述

构建后结果如图所示
在这里插入图片描述
若是从git从拉取的代码,配置如下
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值