多测师是一家拥有先进的教学理念,强大的师资团队,业内好评甚多的接口自动化测试培训机构!

17727591462

联系电话

您现在所在位置:接口自动化测试培训 > 新闻资讯

QTP学习分享-自动化测试

更新时间:2022-06-06 08:53:49 作者:多测师 浏览:173

  1. 在测试中我们使用QTP调试脚本的时候一般就是DEBUG或者MSGBOX察看一些信息,其实有时候也可以使用print来实现批量的察看信息但是不影响程序运行。

  运行脚本:

  a="100"

  print a

  ~~~~~~~~~~~~~~~~~~~~~~~~~

  2.取datatable特定行的数据可以这样使用

  运行脚本:

  DataTable.GetSheet("Action1").GetParameter("test").ValueByRow(4)

  ~~~~~~~~~~~~~~~~~~

  3.Wait Seconds [, Milliseconds]可以精确到毫秒.

  ~~~~~~~~~~~~~~~~~~

QTP学习分享-自动化测试

  4.在自定义的function里面数组作为返回值.

  运行脚本:

  circuit = "399937"

  Function trimString(circuit)

  Dim holdArray(5)

  holdArray(0) = Left(circuit, 2)

  holdArray(1) = Right(circuit, 2)

  msgbox holdArray(0) 'showed 39

  trimString = holdArray' I get an out of range error here

  End Function

  dim myArray

  'here I want to assign the return array to another array

  myArray = trimString(circuit)

  ' and then call one element from it

  msgbox myArray(1)

  ~~~~~~~~~~~~~~~

  5.计算一个操作的时间.

  运行脚本:

  Browser("Browser").Page("Page").Image("getRates").Click

  var_StartTime = Timer

  Browser("Browser").Page("Page").Sync

  Browser("Browser").Page("Page").Check CheckPoint("Check1")

  var_EndTime = Timer

  intRespTime = round ((var_EndTime - var_StartTime), 2 )

  msgbox (intRespTime)

  ~~~~~~~~~~~~~~~

  6.取得指定sheet(datatable)的行数和列数(也可以理解为参数个数)

  paramcount = DataTable.GetSheet("Action1").GetParameterCount

  msgbox "There are " ¶mcount&"columns in the data sheet."

  rowcount = DataTable.GetSheet("Action1").GetRowCount

  msgbox "There are " &rowcount&"rows in the data sheet."

  以上内容为大家介绍了自动化测试中QTP学习分享,本文由多测师亲自撰写,希望对大家有所帮助。了解更多自动化测试相关知识:https://www.aichudan.com/xwzx/

联系电话

17727591462

返回顶部