zoukankan      html  css  js  c++  java
  • Jenkins pipeline,Jmeter接口测试

     1 pipeline {
     2     agent any
     3 
     4 
     5     stages {
     6         stage('reg') {
     7             steps {
     8                 bat 'C:\Users\Administrator\Desktop\apache-jmeter-5.3\bin\jmeter.bat -n -t G:\AutomationTest\pipeline_test\reg.jmx -l G:\AutomationTest\pipeline_test\report\Jmeter-Result1.jtl'
     9             
    10                 bat 'G:\AutomationTest\pipeline_test\checkReport.bat'
    11             }
    12         }
    13         
    14         stage('search') {
    15             steps {
    16                 bat 'C:\Users\Administrator\Desktop\apache-jmeter-5.3\bin\jmeter.bat -n -t G:\AutomationTest\pipeline_test\search_user.jmx -l G:\AutomationTest\pipeline_test\report\Jmeter-Result2.jtl'
    17             }
    18         }
    19         
    20     }
    21 }

    检查一下有没有失败的用例, 有失败,就返回1构建失败。没有失败就执行下一个步骤。 (麻烦就是变量不能用在bat里面,麻烦。。。。。。。。)
     1 findstr /i "error" G:\AutomationTest\pipeline_test\report\Jmeter-Result1.jtl
     2                 if NOT %ERRORLEVEl% == 0 (
     3                     echo "无失败case"
     4                     exit 0  #然后再退出,jenkins就会报红显示构建失败
     5                     
     6                 )else (
     7                     echo "有失败case"
     8                     exit 1  #然后再退出,jenkins就会报红显示构建失败
     9                 )
    10                 pause>nul
  • 相关阅读:
    使用paramiko的问题记录
    python常见异常及解决方法
    linux ps -aux各列含义
    常用技能
    超时程序管理
    跨年的总结和展望
    java json和对象互转
    一些常用功能总结
    ResultSet转成java类对象
    python常用功能总结
  • 原文地址:https://www.cnblogs.com/rood/p/14242223.html
Copyright © 2011-2022 走看看