美文网首页Shellshell
软件测试常用shell脚本

软件测试常用shell脚本

作者: 测试菜鸟 | 来源:发表于2018-12-30 23:54 被阅读1次

    一 循环

    #!/bin/bash

    mv perf.log perf.log_bak

    while (( "1"=="1" ))

    do

    java -cp 'conf/:apps/*:lib/*' org.bcos.channel.test.db.PerfomanceOk trans 50000 100  >>  perf.log

    sleep 550

    done

    二 预期输入

    #!/bin/bash

    set -x

    set -e

    ethconsole ${node_path}/nodedata-1/data/geth.ipc <<EOF

    web3.admin.getPeers(console.log);web3.eth.getBlock(2,console.log)

    EOF

    /usr/bin/expect << EOF

    set timeout 500

    spawn ./install_node.sh install

    expect "gavin:"

    send "Aa12345!\r"

    expect "Installing eth environment success"

    EOF

    三 函数调用

    running(){

      sleep 1

      old_count=`grep +++++  ${host_path}/build/nodedir$1/log/info*|wc -l`

      sleep 7

      new_count=`grep +++++  ${host_path}/build/nodedir$1/log/info*|wc -l`

      if((${old_count}<${new_count}))

      then

        echo "****** success, node$1 is running normally ******"

        #return true

      else

        echo "****** fail,node$1 is not running ******"

        #return false

      fi

    }

    running 3

    四 curl命令借口测试

    curl -X POST --data '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":83}' 127.0.0.1:8545

    curl -s -l -H "Content-type: application/json" -X POST -d '{"seqNo":"1067","orgNo":"123","chainId":"100120043","chainName":"he43","chainContent":"test43","extId":"ex43"}'http://10.107.105.143:9000/api/chain/new

    五 根据日志统计

    grep '2018-09-06 19:1' appmonitor.log|grep New |awk -F '"' '{a+=$8;b+=1} END {print a,b,a/b}'  统计19:10-19:19分,所有上链的次数和平均耗时

    相关文章

      网友评论

        本文标题:软件测试常用shell脚本

        本文链接:https://www.haomeiwen.com/subject/htoblqtx.html