
Overview
Functional Tester (hereafter referred to as RFT for brevity) is a testing tool by using which you can automate your interactions with any test application, say type some text in a text box, click on a button, hover over an image – with almost zero intervention from you, the user. That definitely sounds useful, but you might still often find yourself in situations where you look for functionality to accomplish more specific goals:
- I want to create a test case from a piece of code.
- I want to combine multiple tests into a test suite.
- I want to produce a detailed report of tests that passed/failed, which is also presentable and eye-candy.
- I want to prioritize test case execution and establish run time dependencies across test cases.
All that sounds familiar, doesn’t it? Here’s introducing the RFT-TestNG framework that will help you develop automated business scenarios like the ones listed above in a jiffy.
Functional Tester – What is it?
Functional Tester is an automated functional testing and regression testing tool that provides automated testing capabilities for functional, regression, GUI and data-driven testing. It supports a range of applications, such as web-based, .Net, Java, Siebel, SAP, terminal emulator-based applications, PowerBuilder, Ajax, Adobe Flex, Dojo Toolkit, GEF, Adobe PDF documents, zSeries, iSeries and pSeries.
TestNG – What’s in it for you?
TestNG is an open source next generation test automation framework that simplifies a wide range of your testing needs, from unit testing to integration and functional testing.
What features does TestNG have to offer?:
- Supports annotations that are easy to understand and accept parameters.
- Supports Java and OO features.
- Supports parameterization.
- Supports ‘test groups’.
- Supports dependent test methods, parallel testing, load testing, and partial failure.
- Supports separation of compile-time test code from run-time configuration/data.
The RFT-TestNG framework
With the RFT-TestNG framework, you can:
- develop test scenarios more easily, quickly, and in a flexible manner.
- create business scenarios by grouping Functional Tester tests even without opening Functional Tester scripts.
- create run-time dependencies among script executions.
- prioritize Functional Tester script executions.
- handle uncaught exceptions automatically without premature termination of tests and report them as failure steps.
Prerequisites
- Basic knowledge of Functional Tester, TestNG, and the Java programming language, and program execution.
- Basic understanding of software testing processes.
- An internet connection on the computer on which you are setting up the framework.
Procedure
1. Install Functional Tester. For instructions, see Installing Functional Tester.
2. Install TestNG.
a) Open RFT. Click Help > Install New software.
b) Copy the following URL: http://beust.com/eclipse and paste it into the Work with text box and click Add.

c) In the “Add Repository” dialog, enter a name for the repository and click
OK.

d) In the left pane, click
TestNGto expand it.
e) Select the
TestNGcheck box.
f) Click
Next, and then
Finish.
g) Restart Functional Tester.
3. To verify the installation, open
Window >
Preferences. Verify that
TestNG is listed in the left pane.

4. Create an Functional Tester project and record or write test scripts as needed. For details, see
RFT Knowledge Center.
5. Update the properties of the new Functional Tester project to include the TestNG libraries:
a) Right-click the project and select
Properties.
b) In the
Properties window, select
Java Build Path.

c) Open the
Libraries d) Click
Add Library.
e) In the "Add Library" dialog, select
TestNG.
f) Click
Nextand then click
Finish.
OK, with that step, you are done with the setup of the framework. Now let’s see how to put the framework into use.
As mentioned in the beginning of this blog, one of the primary advantages of using the Functional Tester-TestNG framework is the ease with which you can create and run test suites from multiple different Functional Tester script classes by using just a single configuration file (testng.xml).
1. Open the Functional Tester project and create an XML file called testng.xml. This file describes the runtime definition of the test suite. This is also where you will configure your test runs, set test dependencies, include or exclude any tests, methods, classes or packages, set priorities, and so forth.
2. Copy all your Functional Tester test scripts classes into the <classes> tag in testng.xml. By doing this, you ensure that only those tests that are listed in testng.xml are executed.
You are free to name the <suite> tag and the <test> tag based on your preferences, but the name of the <classes> tag must be a combination of the name of the package and name of the Functional Tester test script.
Following is an example of the testng.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1">
<test name="test1">
<parameter name="pwd" value="testRFT"/>
<classes><class name="LaunchApplication" />
<class name="PlaceOrder" />
<class name="ValidateOrder" />
</classes></test></suite>
3. Update the Functional Testertest scripts with the TestNG annotations:
The Functional Tester-TestNG framework does not execute automation code that’s part of the Functional Tester's testMain() method. Hence, ensure that all the executable automation code in the Functional Tester test scripts lie outside of the testMain() method, but included in other public java methods. Then, annotate the RFT script class methods with @Test.
Note: TestNG allows execution of only those Java methods in the Functional Tester scripts that are annotated by @Test. To use annotations in TestNG, you must import the org.testng.annotations.* package into the Functional Tester script class. Also ensure that you add all these script classes into the <classes> tag in
testing.xml.

4. To execute a test suite in the Functional Tester-TestNG framework, you need a driver script. To create a driver script, copy the following code snippet into the testMain method in an empty Functional Tester script:
// Create object of TestNG Class
TestNG runner=new TestNG();
// Create a list of String
List<String> suitefiles=new ArrayList<String>();
// Add xml file which you have to execute.
// Please update this path with your testng xml path location
String testNG_xml_file_Path=<testing.xml complete path>; suitefiles.add(testNG_xml_file_Path);
// now set xml file for execution
runner.setTestSuites(suitefiles);
// finally execute the runner using run method
runner.run();
When you start the execution, the TestNG classes are initialized and point to testing.xml which will in turn run the test suite.
Anexample Functional Tester-TestNG project
This blog also presents an example project (RFTProject_inside_TestNG.zip) for your reference. Follow these steps to playback any test suite in the Functional Tester -TestNG framework:
1. Download RFTProject_inside_TestNG.zip andextract it.
2. Open RFT and switch to the Functional Test perspective.
3. Click File > Import > Functional Test > Functional Test Project Items.
4. Click Next.
5. Navigate to the project you extracted in Step 1 (RFTProject_inside_TestNG.rftjdtr) and open it.
6. Click Next and then Finish to finish the import.
7. Verify that TestNg_RFT_Integration_Project is loaded into RFT along with the following RFT script classes:
- DriverScript (the RFT-TestNG driver script)
- LaunchApplication (sample test script)
- PlaceOrder (sample test script)
- ValidateOrder (sample test script)
8. Playback
DriverScript. At end of the playback, the RFT playback log and a TestNG report will be generated.
Download File
NAVANITK SINGH
Software Test Architect
Navanit K Singh is a Software Test Architect who is currently working on Rational Functional Tester and Rational Test Web UI Tester.
He has more than 11 years of experience in the software industry.
SHIVI SIVASUBRAMANIAN
Principal Technical Writer
Integration Tester
Shivi is a senior technical writer who has more than 13 years of experience in the software industry.
She's currently a member of the Integration Tester project team and works out of the HCL office in Bengaluru.