python+pytest+jenkins 接口测试

  • 1.python优点

    • 1、java语句比较严谨,python比较灵活;
    • 2、python有众多可用的模块库,类似 java的开源jar包
    • 3、python学习成本低
    • 共同点:
  • 2.pytest优势

    • 1、简单易上手,适合单元测试
    • 2、pytest的fixture支持函数活类参数化,参考文档
    • 3、pytest具有很多第三方插件,并且可以自定义扩展,比较好用的如pytest-selenium(集成selenium)、pytest-html(完美html测试报告生成)、pytest-rerunfailures(失败case重复执行)等;
  • 3.jenkins核心配置

    • 1、安装与配置(自行🔍)
    • 2、shell脚本配置
    • shell代码:
source /data/program/venv3/bin/activate
cd /data/program/venv3/project/auto
rm -rf asset-http-automation/
git clone git@git.caimi-inc.com:finance-qa/asset-http-automation.git
if [ $? -ne 0 ]; then  
    echo "...............error occur, retry in 2 seconds .........."  
    sleep 2  
    rm -rf asset-http-automation/
    git clone git@git.caimi-inc.com:finance-qa/asset-http-automation.git 
fi
cd asset-http-automation
python3 -m pytest -s case/it/  --html=testreport/test_report.html --self-contained-html
exit_code=$?
exit $exit_code
  • 如图:在这里插入图片描述
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值