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

  • 相关阅读:
    mysql数据库安装,启动和关闭
    python学习笔记(xlsxwriter模块使用)
    redis集群搭建
    gpasswd 命令详解
    linux CPU使用率过高或负载过高的处理思路
    Django模型(ORM)
    Django模板层(template)
    Windows下安装node.js(npm) git+vue
    Sublime Text 3:3114的安装(目前最新),插件emmet的安装
    opacity在IE6~8下无效果,解决的办法
  • 原文地址:https://www.cnblogs.com/testway/p/6780774.html
Copyright © 2011-2022 走看看