一个shell脚本写的测试框架
2017-07-03 22:12
639 查看
这是我进实验室进项目组写的第一程序,shell脚本写的用在项目中测试例的自动化测试测试。
#!/bin/bash
str1="Success"
str2="Failed"
str3="No_test"
num_failure=0
num_success=0
num_no_test=0
loop_cnt=1
test_port="$1"
for((k=0;k<${loop_cnt};k++)) ; do
while read
test_tcl_name
cycle_time
do
if [ "$test_tcl_name" == "" ];then
continue
fi
for ((j=0;j<"$cycle_time";j++)) ; do
echo "---------------------------------------------"
logfile=$(date +"%Y-%m-%d%H%M%S")
start_time=$(date +"%s")
#echo "logFile:$logfile" >>autotest_notes.log
echo "admin" |sudo -s ./parser_testcase_script.tcl "$test_port" $test_tcl_name >autotest_notes.log
./parser_testcase_script.tcl $test_port $test_tcl_name
grep "Test Scripts Success" autotest_notes.log
result_test=$?
echo "$result_test"
if [ "$result_test" == "0" ];then
let "num_success+=1"
echo $test_tcl_name $str1 >>autotest_result.txt
else
let "num_failure+=1"
echo $test_tcl_name $str2 >>autotest_result.txt
echo "$test_tcl_name">>autotest_result.bug
grep "Matched Failed" autotest_notes.log >>autotest_result.bug
echo "-----------------------------------------------" >>autotest_result.bug
fi
done
done <$2
done
echo "------------------------------------------">>autotest_result.txt
let "total=num_success+num_failure"
echo total $total Success $num_success Failed $num_failure >>autotest_resilt.txt
echo "total: $total , Success :$num_success, Failed: $num_failure"
#!/bin/bash
str1="Success"
str2="Failed"
str3="No_test"
num_failure=0
num_success=0
num_no_test=0
loop_cnt=1
test_port="$1"
for((k=0;k<${loop_cnt};k++)) ; do
while read
test_tcl_name
cycle_time
do
if [ "$test_tcl_name" == "" ];then
continue
fi
for ((j=0;j<"$cycle_time";j++)) ; do
echo "---------------------------------------------"
logfile=$(date +"%Y-%m-%d%H%M%S")
start_time=$(date +"%s")
#echo "logFile:$logfile" >>autotest_notes.log
echo "admin" |sudo -s ./parser_testcase_script.tcl "$test_port" $test_tcl_name >autotest_notes.log
./parser_testcase_script.tcl $test_port $test_tcl_name
grep "Test Scripts Success" autotest_notes.log
result_test=$?
echo "$result_test"
if [ "$result_test" == "0" ];then
let "num_success+=1"
echo $test_tcl_name $str1 >>autotest_result.txt
else
let "num_failure+=1"
echo $test_tcl_name $str2 >>autotest_result.txt
echo "$test_tcl_name">>autotest_result.bug
grep "Matched Failed" autotest_notes.log >>autotest_result.bug
echo "-----------------------------------------------" >>autotest_result.bug
fi
done
done <$2
done
echo "------------------------------------------">>autotest_result.txt
let "total=num_success+num_failure"
echo total $total Success $num_success Failed $num_failure >>autotest_resilt.txt
echo "total: $total , Success :$num_success, Failed: $num_failure"
相关文章推荐
- 一个测试下载速度的shell脚本
- 自己写的一个测试RAC LoadBalance的shell脚本
- 基于shell写的一个简单的人机交互的测试框架
- 一个测试下载速度的shell脚本
- PSAttack:一个包含所有的渗透测试用例的攻击型Powershell脚本框架
- 测试一个域名DNS查询时间的shell脚本
- Java tcp服务器框架 以及一个简单命令行聊天的测试例子
- 一个不错的shell 脚本教程
- Watir 试用手记——一个很不错的开源 Web 自动化测试框架
- 如何编写一个shell脚本
- 一个比较好的shell脚本编程入门文章
- 如何编写一个shell脚本
- 用TestComplete实现一个关键字驱动测试框架
- 一个shell脚本解多个压缩文件(改别人的代码)
- 脚本文件(shell perl python)编程的总结的框架。
- 测试一个silverlight游戏框架
- 写了一个简单的shell脚本监控mysql服务器运行状态
- 脚本和web页共用同一个文件测试
- 〔原创〕Watir 试用手记——一个很不错的开源 Web 自动化测试框架
- 如何编写一个shell脚本(转贴)