The control part value is not refreshed synchronously when the script is executed in testcomplete.

Source: Internet
Author: User
Tags testcomplete

Today, I wrote an automated script for program installation. During debugging, I found that some controls were not automatically refreshed after their values were obtained. In view of this problem, after careful analysis and consultation, testcomplete does not automatically refresh the changed values in the control. Therefore, we need to control the refresh.

1. Define a delay function (parameter: delay seconds, execution delay condition)

Function timedelay (delayseconds, condition)
Dim interval, starttime
Starttime = Time
Do While cbool (condition)
Sleep (delayseconds * 1000)
Interval = second (time-starttime)
If interval = 40 then
Log. Error ("time out .")
Exit do
End if
Loop
End Function

 

2. namemapping a progress display control (value of the control: 0%-100% ):

Set installprogress = aliases. sqlnav. frmsqlnavwizard. panelmain. panelframeholder. selectproduct. pnlnewproducts. pnlrightinstallprogress. labelinstallprogress

 

3. Call a function in a script:

Call timedelay (2, installprogress. Caption <> "100% ")

The latency is found until the specified time out is exceeded. The reason is that the installprogress control is analyzed at the top. the value of caption is not dynamically refreshed. the value obtained during the call remains unchanged.

 

4. Modify the script:

For controls with dynamic values, it is obviously not suitable to use the above delay function. For latency processing under controls with dynamic values, you can write a script separately for processing, use the refreshmappinginfo () method that comes with testcomplete to refresh the control:

Dim begintime
Begintime = Time
Do While installprogress. Caption <> "100%"
Sleep (2000)
Installprogress. refreshmappinginfo
If second (time-begintime) = 40 then
Log. Error ("time out .")
Exit do
End if
Loop

Or you can add SYS. Refresh () to the function to refresh the entire program. However, we do not recommend that you use this method. The overall refresh is performance-consuming.

This article is from the "qytag (upspringing)" blog, please be sure to keep this source http://qytag.blog.51cto.com/6125308/1568748

The control part value is not refreshed synchronously when the script is executed in testcomplete.

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.