Linux shell 批量运行jmeter脚本

#!/bin/bash

jmxpath=
outputpath=

function readfile ()
{
  for file in `ls $1`
  do
    if [ -d $1"/"$file ]
    then
      readfile $1"/"$file
    else
    if [ "${file##*.}" == "jmx" ];
        then
           echo $jmxpath"/"$file
           filename="${file%.*}"
           run_jmeter $jmxpath"/"$file $filename $outputpath
        fi
    echo `basename $file`
    fi
  done
}

function run_jmeter () {
  echo $1 $2 $3
  mkdir -p $3"/out/"$2"/"
  jmeter.sh -n -t $1 -l $3"/"$2".jtl" -e -o $3"/out/"$2"/"
}

if  [ ! -n "$1" ] ;then
    echo "Please input the target test case jmx path"
    read jmxpath
else
    jmxpath=$1
    
fi

if  [ ! -n "$2" ] ;then
    echo "Please input the test results out path"
    read outputpath
else
    outputpath=$2
    
fi

readfile $1 $2

猜你喜欢

转载自www.cnblogs.com/majestyking/p/10747888.html