Talking about RFT

Source: Internet
Author: User

What is RFT?

RFT's full name is Rational functional Tester, a product of IBM Corporation. Previously called rational XDE Tester, a little earlier called ROBOTJ. RFT provides solutions for automating the testing of Java programs,Web applications, Eclipse, and end applications. It supports Windows and Linux platforms. RFT supports pure Java as well as vb.net as its automated test scripts, as the author works on the Java EE platform, the following will only involve the use of JavaScript as an automated test script, But its principles can also be applied to scripts written by vb.net. Chart 1 The main interface of RFT is the main interface of RFT. The version of RFT that I am using is 6.1.1.1.

Chart 1 RFT the main interface

2. Understanding RFT's Object recognition

The process of developing automated test scripts using RFT is roughly: recording object mappings and using object mappings to manipulate GUI objects to complete automated testing. So we first understand the RFT object recognition.

2.1. Object Mapping File

In RFT there is a class of rftxmap suffix file, which is called an object mapping file, which is used to store the identifying information of the measured GUI object. The object mapping file contains the measured GUI objects that can be visualized in the object map Editor. Although such files are text-formatted, they cannot be edited directly like plain text files. Instead, you should use the Recording tool to add objects to the object mapping file. The recognition criteria for editing objects is done through the object Mapping editor.

2.2. Object Mapping Editor

Figure 2 shows an object mapping editor. As we can see, the objects added by the recording tools make up the structure of the tree. Each object has an associated recognition attribute. The button object highlighted in the example, its. Class property value is Javax.swing.JButton, which indicates that this object is a pushbutton component in the Swing component library. It also has other properties. The value of each property is followed by a weight value. The weight value is important for object recognition during the test program run.

Chart 2 Object Mapping Editor

2.3, the process of object recognition

Here is a brief description of the process of object recognition during the test program run. If we need to click on the button represented by the highlighted object in chart 2 during the test. RFT first needs to find the GUI object represented by the root of the object tree where the button resides. It is not difficult to see that the object on the root of the object tree represents a Java frame. As soon as the correct Java frame is started, the object on the root is not difficult to find. RFT will follow the structure of the tree step-by-step to find the corresponding button, so that we can execute the button in the program click Action, so as to complete the test in a simple step. This shows that the recognition of all objects on this tree is important, as long as one of them cannot be identified, then the button can not be found at the end. In the process of recognizing the GUI object, RFT will determine whether the object conforms to the recognition criterion according to an algorithm. This algorithm uses the recognition weight value.

2.4. Object recognition Algorithm

This algorithm is also illustrated by the example of a button object. As you can see, the button object has a recognition weight value of three attributes greater than 0. We assume that the other attribute weight value is 0. Assuming RFT was found in the order of the object tree, 3 candidates were found. There are two. class properties that are not Javax.swing.JButton, with a recognition score of at least 100 (recognition weight) *100 (used to calculate the multiple of the recognition score) = 10000, and if the threshold value (which is the system parameter) is 10000, These two objects will be considered mismatched object mappings. If the property value of the third object conforms to all, its recognition score is 0, less than 10000, and the match succeeds.

2.5. Adjust object recognition

When an object is added to the object Map Library, RFT will establish a default recognition attribute and identify the weight value for the object. If a recognition failure occurs during the test script run. You can adjust it in the following ways:

    • Modify the recognition weights;
    • Add or remove recognition attributes. As an example of a button, there are 3 attributes for recognition, which can be reduced by adding additional recognition attributes.
    • Modifies the value of the recognition attribute. Some properties are character type, and each test is likely to change, this time you can find the law of this change, using regular expressions to express the value of this property. As an example of a button, there is a property called Accessiblecontext.accessiblename, its value is "OK", we change the value to "*ok*", in the test script run process, even if encountered "ABCOKABC" such a value can also achieve matching.
2.6. Dynamic object Recognition

In addition to mapping-based recognition patterns, RFT also provides dynamic object recognition, which is accomplished by defining the find () method in Rationaltestscript and Testobject. Although most Test teams only need to use mapping-based object recognition methods, find () may be required in the following special cases.

    • Identify dynamic objects. Some objects are dynamically changing during operation, and it is meaningless to add these objects to the object map.
    • Supports multi-language testing.
    • Test applications that are unstable or too deep in the object mapping tree.

I have seen a Test team, without the object mapping file provided by RFT, and all with the dynamic object recognition function, it requires the tester to write object recognition attributes to the configuration file. In this way, it can even be detached from the RFT development environment, and only eclipse can develop test scripts.

3. Understanding IBM's Framework

A set of frameworks has been developed within IBM. With this framework, you can provide the following help for your automated test project:

    • Accelerated scripting;
    • Quick commissioning and easy maintenance;
    • Code reuse;
    • Very good organization of script files;
    • Help collaboration;
    • Benefit from the experience of others;

The framework consists of the following three parts: three-tier architecture through Appobjects,tasks and Testcases, IBM Toolkit, and matching best practices. This framework is described below, where the IBM Toolkit is useful, but IBM is not officially released, so this article will not mention it.

3.1, Appobjects, Tasks, and testcases package

The IBM framework recommends dividing the test scripts into three classes of appobjects, tasks, and testcases, and then placing the scripts in appobjects, tasks, and testcases packages. These three types of scripts have such dependency testcases->tasks->appobjects. As shown in table 3, a three-tier architecture is formed. The roles of each layer are described below.

Chart 3 three-tier architecture

Appobjects is used to store information about the application GUI elements. In appobjects you will write some getter methods that return objects to the caller, which will be used to query and manipulate GUI elements. Generally, these getter methods are called at the tasks layer.

Tasks is used to write reusable methods that perform some action on the application. If you need to manipulate and query complex controls that are specific to an application, you can also write in the tasks method. The methods in the tasks package will be called by Testcases.

Testcases is the final test case . They will manipulate the application, verify its status, and record the results.

Here is an example of tasks:

Here is an example of testcases:

3.2. IBM Best Practices
    • Mapping with private rather than shared objects;
    • Use the. properties file to support internationalization;
    • Use script validation instead of validation points. Such as:

If (Boolean test passes)

Log passing result

else log failing result

    • Following the Java naming conventions, the names of variables and classes have some meaning.
4. Summary

RFT as a GUI automation test tool has the following (but not limited to) features:

    • Support for the Java language as its automated test script

This feature not only allows RFT to uphold the many advantages of Java, and makes it easy for RFT developers to introduce various Java components: Spring Framework, Hibernate, etc. We can also use the Open Source Workflow engine OBE to enable the externality of process logic in test scripts.

    • Providing its functionality in the form of an eclipse (IBM Open source IDE) plugin will be easier for anyone familiar with eclipse.

If you introduce IBM's framework, you can further help test teams quickly build automated test scripts and improve their maintainability.

Talking about RFT

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.