前段时间给客户做了个RFT的简单培训,以下。因为涉及到公司的框架,所以中间省去了很多框架里的细节,只留了一个框架的总体结构的概览。
- RFT
IBM Rational Functional Tester is an automated functional testing and regression testing tool. This software provides automated testing capabilities for functional, regression, GUI, and data-driven testing.
What is automation? Writing a program to test another program.
Why need framework?
Most automation tools enable testers to simply record a set of GUI interactions and play them back against the application being tested. The record-playback approach eases the creation of test scripts but leads to extensive test script maintenance. The test team ends up recording and re-recording scripts each time the application changes. Although record-playback features can be used to create suites of test cases quickly, this approach is limited because the application under test should be mostly complete and functioning correctly before a workable script can be recorded. Test teams often abandon the record-playback model and write test cases manually instead. Testers are often limited to using GUI automation for regression testing. The object-recognition algorithms are complex and inaccessible, making updates to the scripts tedious and, in some cases, impossible. Though the tool exposes the recognition algorithms, thereby making updates much more manageable, it also has the unfortunate side effect of making object recognition less reliable.
The automation framework offers many benefits:
- Powerful scripting capability.
- Object-oriented approach to test automation.
- Object recognition algorithm and object maps.
- Ability to dynamically find the test objects using the object's properties.
- Rich set of APIs for scripting without recording the object.
In short
RFT is plugin of Eclipse
1> Java programming
2> Eclipse IDE
3> Rich set of APIs to create test automation frameworks
- Scripts 3 level structure
The scripts are the 3rd level of framework.
Example: Apply_full_payment_to_a_single_tax_type_and_print_PV.java in TestScript\APD folder
- Object Map files
There are 2 kinds of files of one object map. One is “.rftdef” file and another is “.rftxmap”.
These 2 files mapped by test object ID. The ID is automated generated by RFT for each object.
1> .rftdef: Defined the logical name and ID
2> .rftxmap: Properties stored in this file
RFT recognize the object by using the properties stored here.
- Mapped Object & Bound Object
1> Mapped Object
Objects stored in object map.
Core function getMappedTestObject (String):
TestObject obj = new TestObject (getMappedTestObject (objName));
2> Bound Object
Core functions those return Bound Object:
getChildren(), getMappableChildren(), getOwned(), getParent(), getMappableParent(), getOwner(), find(), getTopParent()
3> Difference
If application changes Mapped Object need to change. But Bound Object doesn’t need.
And Mapped Object usually find quickly than Bound Object.
- The find() function
Two types of find API in Rational Functional Tester:
- find(Subitem Properties).
- find(Subitem Properties, Boolean mappableOnly).
Subitems can be either atChild() or atDescendant() or atList().
- atChild: One or more properties that must be matched against the direct child of the starting TestObject.
- atDescendant: One or more properties that can be matched against any child of the starting TestObject
- atList: A sequential list of properties to match against. Valid subitems for atList are atChild, atDescendant, and atProperty.
- mappableOnly: Arguments that limit the search. If it is set to true, the search for children will be limited to those test objects that are mappable, otherwise non-mappable test objects are also searched.
Find using RootTestObject
RootTestObject represents a global view of the system being tested. It provides access to system-wide functionality, such as finding an arbitrary test object based on properties, location, as well as finding DomainTest Object.