创建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从拉取的代码,配置如下