• 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

  • 相关阅读:
    python课堂整理5---元组
    用python输出回文数
    python课堂整理4---列表的魔法
    python基础知识练习题一
    python课堂整理3---字符串魔法
    python课堂整理2
    python课堂整理1
    励志程序媛---从厂妹到Google年薪60W RMB程序员
    动态链接库--靠谱
    基于VS2019———C++生成自己的静态链接库————良心实战笔记
  • 原文地址:https://www.cnblogs.com/testway/p/6780774.html
Copyright © 2020-2023  润新知