Using RFT Object Maps with SAFS
Balancing SAFS\RFT Portability with Performance
Released 2009.06.15
Changing times, Changing tools...
(Skip the pitch)
Over the years IBM Rational® Functional Tester (RFT) has grown in scope and popularity when compared to older tools like IBM Rational® Robot. This has been great for those using RFT to test more technologies, but for those migrating SAFS tests from Robot to RFT it also means a potential impact on performance as RFT sifts through a growing number of technology proxies looking for just the right match to ported Robot recognition strings.
Porting Tests and App Maps
Fortunately, migrating a SAFS test from using Robot to using RFT is not a "start over" scenario. SAFS\RFT was coded to handle most Robot recognition strings allowing the greatest portion of SAFS tests and App Maps to run with few modifications when migrated to RFT.
However, the convenience of using Robot recognition strings in SAFS comes with a price. Under certain test domains like Win, .Net, and Html the tests might run slower than desired--especially if multiple domains are enabled for testing. If these performance issues are significant enough, the tester may wish to leverage RFT Object Map objects within the SAFS App Map.
(See Create RFT App Maps Info for more background.)
Application-Specific Object Map, Application-Specific Project
Normally, when we are not using app-specific resources in RFT we would not have to make a new RFT Datastore or Project. We simply use the one provided by SAFS at C:\SAFS\DatastoreJ. However, as soon as we start needing custom app-specific scripts or Object Maps then we must create a separate RFT Project dedicated to the application or system being tested. One obvious location is to create an RFT project directly in the SAFS project used for the application or system being tested.
So, let's go about the business of creating a new RFT Project associated with a SAFS Project we created for our NextBigApp at C:\automation\NextBigApp:
Short and Sweet Instructions: (sort of)
(Go to Pretty Pictures "for Dummies"TM)
- Create the Functional Test Project
- Open the RFT IDE
- Ensure RFT is in the "Functional Test" Perspective
- Select File->New->Functional Test Project
- Provide a RFT Project Name: "MyRFTProject"
- Provide a RFT Project location: "C:\automation\NextBigApp"
- If the Rational Test Login dialog appears Cancel or Login as appropriate.
- Verify your RFT Project exists at: C:\automation\NextBigApp\MyRFTProject
- Add JAR files to Project's Java Build Path
- Right-Click Project MyRFTProject in the Navigator view,
- Select Properties from the popup menu,
- Select Java Build Path in the Properties Dialog
- Select button Add External JARs...
- Navigate to C:\SAFS\lib and add 2 JARS:
- safs.jar
- safsrational_ft.jar
- Select button OK to close the Properties dialog.
- Create New Test Object Map
- Select File->New->Test Object Map
- Provide the Map name: AppObjectMap
- Select "Set this Test Object Map as default choice for new scripts"
- Select button Finish
- Close the Test Object Map dialog if it appears.
- Create New Empty Functional Test Script "TestScript"
- Select File->New->Empty Functional Test Script
- REQUIRED Script Name: TestScript,
- Select button Next,
- Ensure /AppObjectMap.rftmap is assigned to TestScript,
- Select button Finish.
- Change the Helper Superclass for TestScript
- Right-Click TestScript.java in the Navigator view,
- Select Properties from the popup menu,
- Change the Helper Superclass to: org.safs.rational.Script
- Select button OK.
- Copy real SAFS\RFT TestScript Assets To Project
- If the asset(s) are not available to copy from C:\safs\datastorej then
extract the files out of the C:\safs\lib\safsrational_ft.jar using a program like WINZIPTM:
- Copy\Extract TestScript.java to: C:\automation\NextBigApp\MyRFTProject\TestScript.java
- Refresh the RFT Project with File->Refresh F5
- Capture Objects in AppObjectMap for Use by SAFS\RFT
- DO NOT RECORD IN TestScript.java TO CAPTURE TEST OBJECT MAP OBJECTS!
- Open TestScript.java in RFT to populate the "Script Explorer" view,
- In Script Explorer, under Test Objects, Right-Click on "AppObjectMap.rftmap" and Select "Open",
- For each object you wish to support in SAFS with TestScript do the following:
- In the "Test Object Map" viewer select "Test Object->Insert Object(s)",
- From the "Select an Object" dialog Drag the Hand and Release on the object to capture,
- Right-Click desired items in the Test Object Map and select "Add to Script TestScript..."
- In the "Script Explorer" view of TestScript,
Right-Click the newly added Test Objects and "Rename" them, as desired.
- Whenever closing the Test Object Map viewer,
Select "Yes" or "OK" to save the changes to AppObjectMap.rftmap,
- Use the Test Object names defined in TestScript in your SAFS App Maps in place of SAFS recognition strings.
Detailed Instructions:
Our SAFS project for NextBigApp was originally created at C:\automation\NextBigApp, as shown below: