Rational's Object Scripting command

Source: Internet
Author: User

Object Scripting Commands

Scripts that are recorded using robot are not very useful in actual test use. The recorded script is a linear script without control structure, if you want to test a large amount of data, relying only on the recorded script test, is not feasible. In addition, a linear script with a checkpoint, which is directly added to the control structure, is not properly replayed. In this case, using the Robot Object Scripting command is a good choice. The method is to use a recording plus a hand-coded blending method. The resulting script is clear, easy to maintain, and powerful.

The following is also an example of a calculator, using Sqagetproperty to get the object properties and using Sqalogmessage to write the test results to the log:

Sub Main
Dim Result As Integer
Dim sum as string
'Initially Recorded: 2003-7-21 11:07:34
'Script Name: jsq-对象脚本
StartApplication "C:\WINNT\system32\calc.exe"
Window SetContext, "Caption=计算器", ""
InputKeys "1{+}1{ENTER}"
Result= SQAGetProperty ("Type=Label;ObjectIndex=1", "Text", sum)
if left(sum,1)="2" then
SQALogMessage sqaPass, "测试通过", ""
else
SQALogMessage sqaFail, "测试失败", ""
end if
Window CloseWin, "", ""
End Sub

In the actual test, you will find that this kind of script is very useful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.