zoukankan      html  css  js  c++  java
  • jenkins构建自动执行jmeter 发送http请求,中间有替换参数路径

    #在构建目录下创建jmeter目录,在这个目录下面执行jmeter性能测试
    mkdir -p $WORKSPACE/target/apache-jmeter-3.1/
    #复制jmeter文件到执行测试目录
    /bin/cp -r /app/jmeter/apache-jmeter-3.1/* $WORKSPACE/target/apache-jmeter-3.1/

    #复制参数文件到jmeter bin目录下
    cp $WORKSPACE/*.csv $WORKSPACE/target/apache-jmeter-3.1/bin
    #修改csv文件地址
    #sed '/testclass="CSVDataSet" testname="CSV Data Set Config"/{n;s/.*/<stringProp name="filename">/app/jenkins/jenkins_home/workspace/3yuan/wx_id.csv</stringProp>/}' $WORKSPACE/3yuan.jmx
    #sed -i '/testclass="CSVDataSet" testname="CSV Data Set Config"/{n;s/.*/<stringProp name="filename">$WORKSPACE/wx_id.csv</stringProp>/}' $WORKSPACE/3yuan.jmx
    sed -i '/testclass="CSVDataSet" testname="CSV Data Set Config"/{n;s/.*/<stringProp name="filename">/app/jenkins/jenkins_home/workspace/3yuan/wx_id.csv</stringProp>/}' $WORKSPACE/3yuan.jmx

    #复制场景文件到jmeter bin 目录下面

    cp $WORKSPACE/*.jmx $WORKSPACE/target/apache-jmeter-3.1/bin
    cat $WORKSPACE/*.jmx

    #执行jmeter测试

    $WORKSPACE/target/apache-jmeter-3.1/bin/jmeter -n -t 3yuan.jmx -l resutl.jtl

    cp resutl.jtl /app/jmeter/jmeter_result/$(/bin/date "+%Y-%m-%d_%H:%M:%S")$JOB_NAME_$BUILD_NUMBER_resut1.jtl
    #dependency:copy-dependencies -DoutputDirectory=target/apache-jmeter-3.2/lib
    #-U clean install dependency:copy-dependencies -DoutputDirectory=target/apache-jmeter-3.2/lib

  • 相关阅读:
    108.Convert Sorted Array to Binary Search Tree
    111.Minimum Depth of Binary Tree
    118.Pascal's Triangle
    122.Best Time to Buy and Sell Stock II
    35.搜索插入位置
    OSI参考模型
    虚拟机访问tomcat
    linux输入ifconfig找不到IP的解决办法
    分层协议、协议、接口、服务
    Spring Boot项目的创建
  • 原文地址:https://www.cnblogs.com/testway/p/6780774.html
Copyright © 2011-2022 走看看