1.环境构筑

1.安装Tera Term。

下载路径如下:

2.安装可运行的PFC环境

2.运用TTL脚本进行自动测试

TTL脚本的命名一览和相关介绍请参考Tera Term的help文件。

TTL脚本作成方法:

脚本的作成比较简单,我这也不说什么了,我就简单介绍下基本上都要用到的几个命令。

a.通过Tera Term连接PFC所在的机器以及断开连接

通过TTL的connect/disconnect命令实现

Connect:

connect '192.168.137.27 /ssh /auth=password /user=username /passwd= passwd'

注:其中username是用户名,passwd是密码

Disconnect:

disconnect 0

注:disconnect后面指定参数0,这样就不弹出确认框了。

b.通过log记录全程操作过程,最终通过比对log确认测试结果。

通过logopen/logclose命令来写log

logopen:

logopen filename 0 1 1

注:filename最好设成命令名,不通ttl脚本不要重复。也可以带执行的时间,

例如:Show_candidate_config_20110426-130939.log

方法如下:

gettime timestr "%Y%m%d-%H%M%S"

getdir mdir

sprintf2 filename '%s\ Show_candidate_config _%s.log' mdir

timestr

logclose:

logclose

c.测试项作成时可能用到的命令

Pause:(暂停)

pause Remarks:Pauses for seconds.

Sendln:(发送命令并换行)

sendln ....Remarks:Causes Tera Term to send characters followed by a new-line character to the host.Send:(发送命令)send ....Remarks:Causes Tera Term to send characters to the host.

If is a string, the string is sent to the host.

If is an integer, its lowest-order byte (0-255) is regarded as an ASCII code of the character, and the character is sent to the host.例如:按Tab键的命令是send

#9wait:(等待匹配的字符串出现)wait [ ...]Remarks:Pauses until one of the character strings is received from the host, or until the timeout occurs. Maximum number of

the strings is 10.

注:使用这个命令是需要设置timeout时间,命令的返回结果保存在resault变量中,

当resault为0时,则为超时。Timeout设置命令如下:

timeout=1/*等号后面的值为整数,设为负则是无限等待*/

waitln:(等待整行匹配的字符串出现)waitln [ ...]Remarks:Pauses until a line which contains one of the character strings is received from the host, or until the timeout occurs.

Maximum number of the strings is 10.注意点同上其他命令例如if,then,elseif,else,endif,goto等请参考help文件。脚本作成的注意点a.不同的ttl脚本内指定的Log文件名不能重复。b.脚本的最后部分请清空测试环境,以便下一个ttl脚本执行。c.在执行比较缓慢的地方,例如连接机器时,请追加pause命令d.脚本尽量写得简洁短小,以便式样发生变更时易于更改。e.必要的时候可以追加注释

使用例子:

1,在window下创建bat文件,

"C:\Program Files\teraterm\ttpmacro.exe" "D:\My Kownhow\TTL\test.ttl"

exit

2,生产ttl脚本文件test.ttl

;###connect host

connect '172.28.92.23 /ssh /auth=password /user=root /passwd=password'

pause  1

;###create log

gettime logstr "log-%Y%m%d-%H%M%S.txt"

getdir curdir

sprintf '%s\%s' curdir logstr

filename = inputstr

logopen filename 0 1 1

logwrite 'Log start'#13#10

looptimes = 1 ;

while looptimes < 11

;###run cmd

sendln "ls -l"

wait "#"

looptimes = looptimes + 1

endwhile

;###closelog

Logclose

;###disconnect

disconnect

closett

执行bat文件就可以运行ttl脚本了。(完)

teraterm 执行sql命令_tera term的ttl脚本使用方法 | 学步园相关推荐

  1. teraterm 执行sql命令_tera term的ttl脚本使用方法

    介绍几个常用的命令 a.通过Tera Term连接PFC所在的机器以及断开连接 通过TTL的connect/disconnect命令实现 Connect: connect '192.168.137.2 ...

  2. teraterm 执行sql命令_tera term的ttl脚本使用方法[转]

    介绍几个常用的命令 a.通过Tera Term连接PFC所在的机器以及断开连接 通过TTL的connect/disconnect命令实现 Connect: connect '192.168.137.2 ...

  3. python 调用mysql_Python中直接在MySQL执行SQL命令

    因为懒,所以不想用SQLyog,用Python写了一个快速执行SQL命令的程序:import pymysql,sys class dealMySQL(object): 'PyMysql' versio ...

  4. Spark-Sql整合hive,在spark-sql命令和spark-shell命令下执行sql命令和整合调用hive

    1.安装hive 如果想创建一个数据库用户,并且为数据库赋值权限,可以参考:http://blog.csdn.net/tototuzuoquan/article/details/52785504 2. ...

  5. Python执行 SQL 命令并实时打印输出

    需要借助exe_command函数,该函数通过subprocess执行 shell 命令,并实时打印输出. from subprocess import Popen, PIPE, STDOUTdef ...

  6. SQLCMD下执行SQL命令失败但没有任何错误提示

    转载于:https://www.xin3721.com/Articlesqldatabase/sql12441.html 今天使用SQLCMD执行SQL文件,将数据导入到SQL SERVER数据库中, ...

  7. shell脚本mysql_Shell脚本中执行sql语句操作MySQL数据库的几个方法

    实验如下: [root@idb1 ~]# more /etc/issue CentOS release 6.5 (Final) Kernel \r on an \m mysql> show va ...

  8. java阻塞执行命令_java执行bat命令碰到的阻塞问题的解决方法

    使用Java来执行bat命令,如果bat操作时间过长,有可能导致阻塞问题,而且不会执行bat直到关闭服务器. 如: Runtime r=Runtime.getRuntime(); Process p= ...

  9. SpringWeb项目Maven执行clean命令后编译拒绝访问的解决方法

    执行clean命令后准备编译打包,报错如图 问题原因:可能是clean后没有清除干净,还在访问原来的classes文件,但是没有权限 解决方法: 使用IDEA的 清除缓存重启一下 使用Eclipse的 ...

最新文章

  1. Kafka中topic的Partition,Kafka为什么这么快,Consumer的负载均衡及consumerGroup的概念(来自学习笔记)
  2. 通信协议—HTTP、TCP、UDP
  3. vue中实现美团双级联动菜单
  4. UmiJS CDN 部署之 publicPath
  5. C语言程序判断计算机的CPU大小端
  6. 第四节:跨域请求的解决方案和WebApi特有的处理方式
  7. 计算机网络之网络层:9、BGP协议
  8. 自定义搜索框,带提示信息的搜索框
  9. c语言char aa 1000,char ** 与char * a[ ] 区别
  10. java缓存技术的介绍
  11. 08 SCLSDA,类IIC协议(附源码)
  12. 街头篮球上读取服务器维护,《街头篮球》九月新版引入超级服务器
  13. K-均值聚类(K-means)
  14. 交直流调速系统matlab,MATLAB与交直流调速系统仿真.ppt
  15. 徕卡全站仪蓝牙android,App蓝牙连接莱卡系列全站仪Geocom
  16. 大snbsp;汪小菲nbsp;闪婚
  17. IE低版本提示下载新的浏览器js--IEOutTips.zip
  18. 数据库MySQL经典面试题之SQL语句
  19. 吗咿呀嘿-用js来搞个简单的人脸识别
  20. 配置maven私服nexus

热门文章

  1. dbus-glib-0.108 arm交叉编译
  2. 组件中使用_React四种组件通信详解
  3. python多线程执行_python多线程实现同时执行两个while循环
  4. 结构体排序二~1339: 考试排名(带技巧的输入)
  5. 在c语言中函数的定义变量的值为,变量定义(C语言中变量的声明和定义)
  6. php的cgi的设置,apache中配置php支持模块模式、cgi模式和fastcgi模式
  7. 还在犹豫吗?现在参与 OCM 社区正是时候
  8. 2021阿里云开发者大会|【云原生数据库:一站式数据服务】分论坛即将开启
  9. 分享实录 | 深度学习技术红利下的代码补全
  10. 阿里云边缘计算与云边端协同网络的融合与挑战