一个shell脚本写的测试框架

这是我进实验室进项目组写的第一程序,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"


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值