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
  • 相关阅读:
    9.10 作业
    Day 03 作业
    Day02作业
    Day09 函数
    day08 简单习题
    Day04 python数据类型和词云的生成
    JAVA: 子类通过static块“覆盖”父类的成员变量风险
    JAVA: 子类“覆盖”父类的成员变量
    Java 访问控制权限
    Java数组类型转为集合类型
  • 原文地址:https://www.cnblogs.com/rood/p/14242223.html
Copyright © 2011-2022 走看看