How to use RFT dynamic scripts to improve the flexibility and reusability of test scripts

Source: Internet
Author: User
Keywords Test scripts
Tags aliyun applications automated testing change click data developed etc

IBM Rational Functional Tester (RFT) is a Java-developed, support graphical interface http://www.aliyun.com/zixun/aggregation/18863.html "> automated testing tool." RFT supports the recording and playback of test scripts on a variety of applications (HTML Web pages, Flex, java,.net, etc.). At the same time, RFT provides a series of APIs to easily modify RFT automatically generated test scripts, or to write scripts manually. RFT provides scripts for Java syntax, and people with experience in Java programming can easily read scripts. This paper mainly introduces the use of RFT in Flex test and some practical experience.

Introduction to RFT Recording

RFT provides a convenient recording and playback function. After the recording program is started, the user can perform a series of actions on the target page, which will be recorded and translated into the corresponding scripting language. For example: Click on a button:

The script that will be generated is: Button_btnnew (). click ();

The RFT can recognize that the action object is a flexbuttontestobject, and the operation is click ().

Select a column of items in a list:

The script that will be generated is: List_filterenumlist1 (). Select ("Anitem");

RFT can recognize that the action object is a flexlistbasetestobject, and the operation is select ().

Each of the different flextestobject has its own unique operation (i.e., RFT provides different APIs), such as the list object has a Select method, and the input box (TextInput) has SetText method At the same time they have the same action (that is, inheriting the public APIs from the parent class), for example, all Flex objects have the click Method.

The object of the action is also recorded and stored in an object mapping table. This object mapping table is a tree-structured table in which each recorded object is placed in its place in the page component structure. When the RFT is played back, the object mapping table is used as the basis for object recognition, the target is locked on the playback page, and the corresponding operation is performed. You can open the object map by selecting the Script => open Test object Map in the RFT toolbar. As shown in Figure 1, the objects under the RFT record are displayed in a hierarchical structure.

Figure 1. Object Mapping Table

Limitations of recording scripts and solutions

The actual test environment is a changing environment, the first constant testing and use will make the data change, second, the new function will be continuously added to the application, the interface will change. The factors that make these changes require a high demand for automated scripts. Because there is a lot of static data in the recording script, if only with simple recording function, can not achieve very good flexibility, testers need to constantly modify the script to adapt to change, the loss of the effectiveness of automated testing. To improve the flexibility of the script to work properly in a variety of environments, we can use the rich APIs provided by RFT to optimize the recorded static script and add dynamic scripts.

We introduced the technique of adding dynamic scripts from three aspects through a case study.

Get Dynamic Data Dynamic Control object Interface Change Update component

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.