第一版,这些代码有点问题,需要继续更改
#!/bin/bash jmxpath=
reportpath= timestamp=$(date +%Y%m%d_%H%M%S)
echo timestamp
function readfile ()
{
for file in `ls $`
do
if [ -d $"/"$file ]
then
readfile $"/"$file
else
if [ "${file##*.}" == "jmx" ];
then
echo $jmxpath"/"$file
filename="${file%.*}"
run_jmeter $jmxpath"/"$file $filename $reportpath
fi
echo `basename $file`
fi
done
} function run_jmeter () {
echo $ $ $
# mkdir -p $"/out/"$$timestamp"/"
jmeter.sh -n -t $ -f -l $"/"jtl"/"$"/"$$timestamp".jtl" -e -o $"/"html"/"$"/"$$timestamp
} if [ ! -n "$1" ] ;then
echo "Please input the target test case jmx path"
read jmxpath
else
jmxpath=$ fi if [ ! -n "$2" ] ;then
echo "Please input the test results out path"
read outputpath
else
outputpath=$ fi readfile $ $
第二版,这些代码有点问题,需要继续更改
#!/bin/bash jmxpath=$
reportpath=$ function readfile ()
{
for file in `ls $`
do
if [ -d $"/"$file ]
then
readfile $"/"$file
else
if [ "${file##*.}" == "jmx" ];
then
echo $jmxpath"/"$file
filename="${file%.*}"
run_jmeter $jmxpath"/"$file $filename $reportpath
fi
echo `basename $file`
fi
done
} function run_jmeter () {
echo $ $ $
timestamp=$(date +%Y%m%d_%H%M%S)
echo timestamp
mkdir -p $"/html/"$"/"$$timestamp"/"
mkdir -p $"/jtl/"$"/"
jmeter.sh -n -t $ -f -l $"/jtl/"$"/"$$timestamp".jtl" -e -o $"/html/"$"/"$$timestamp
} if [ ! -n "$1" ] ;then
echo "Please input the target test case jmx path"
read jmxpath
else
jmxpath=$ fi if [ ! -n "$2" ] ;then
echo "Please input the test results out path"
read reportpath
else
reportpath=$ fi readfile $jmxpath $reportpath