最近学习简单了解了一下jenkins,并记录记录。
Python源码demo
简单新建测试用例:test_cases.py。
参见:https://gitee.com/yyunShen/allure_demo/tree/master
#test_cases.py
# !/usr/bin/env python
# -*-coding:utf-8 -*-
import pytest
class TestCases:
def test_one(self):
print("执行用例-1-")
assert 't' in "this"
def test_two(self):
print("执行用例-2-")
assert 1 == 1
def test_3(self):
print("执行用例-3-")
assert 'p' in "iphone"
# def test_4(self):
# print("执行用例-4-")
# assert 4 == 5
if __name__ == '__main__':
pass
# 终端命令
# pytest test_cases.py --alluredir=allure_result
# allure generate allure_result -o allure_report
allure本地测试:
- 注:本地已安装allure并添加allure至环境变量
- pip install allure-pytest(安装这个辅助allure生成测试报告)
- 当前项目下,终端输入:
pytest test_cases.py --alluredir=allure_result
test_cases.py (测试用例文件)
–alluredir=allure_result (指定allure执行后产生的数据位置,为多个json文件,用作后续报告生成)
- 第二个命令用作将第二步的json文件转为以HTML展示
allure generate allure_result -o allure_report
allure_result (第二步中json文件位置)
allure_report (报告位置)
- 进入allure_report/index.html查看allure报告
提交代码至gitee
- 需配置git环境,git下载地址:https://git-scm.com/downloads。
1、注册并登录gitee,新建项目allure_demo。
2、右键,git bash here,输入git init 并新建 .gitignnore文件,并将当前目录下不需上传gitee文件添加进.gitignnore,如下图。
git init
touch .gitignnore
<