You are on page 1of 87

TRAINING

<Title of the Presentation>

Automation Testing & IBM -


RFT

Vijay Chowthri N

vijayc@ibsplc.com
vijaychowthri@gmail.com

icargo – Automation Testing Team

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 1
TRAINING
<Title of the Presentation>
Agenda
Understanding Automation Testing

Web Automation

Road map to Success

RFT – Training (Session 1 to 4)

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Automation
Testing
What's Automation Testing ?
Test automation is the use of software to control the execution of tests (Test
Case).

Commonly, test automation involves automating a manual process already in


place that uses a formalized testing process.

Why -> Reduce the impact on the bottom line (Regression


? Testing)
-> Increase the flexibility of time and resource , to avoid redundancy on
execution.
-> Accuracy & Fast

When -> Frequency Of regression testing on demand.


? -> Frequency of build
-> Mission critical business
-> To avoid Human errors
-> To check Load Capacity of the application.
-> GUI Frozen

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Is it Expensive ?
Yes of course ! Its expensive and time consuming effort at initial stage.

Automation Testing - Capabilities and Areas


1) Functionality testing
2) Regression Testing
3) Performance Testing
3.a) Stress Test
3.b) Load Test
3.c) Volume Test

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Are you thinking of 100% Automation ?

-> Impossible ..Stop Dreaming…….

-> Certainly you have areas like performance testing, regression testing, load/stress testing where you
can have chance of reaching near to 100% automation.

-> Areas like User interface, documentation, installation, compatibility and recovery where testing must
be done manually.

Will your automation suite be having long lifetime?

-> Every automation script suite should have enough life time that its building cost should be definitely
less than that of manual execution cost.

-> Approximately your automation suite should be used or run at least 20 to 30 times for separate builds
(General assumption. depends on specific application complexity) to have good ROI.

Is Tool Selection more Important ?

-> Be sure to have skilled staff before deciding to automate your testing work.
-> Make sure that tool is a best fit to your requirements
-> Find out the limitations of the tool that is best match with your requirements

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Web Automation
Why web app is different ? (web based commercial system B-C, B-B & C-C)

-> Catering to large number of end user

-> People with varying background & technical skills may use the application.

-> Network thread (Security , Connection speed (Broad band , dial-up etc.. ))

-> Numerous application usage

-> Browser issue (IE ,Mozilla fire-fox etc.., )

-> ADA (American with disability act) (The Application may need to be tested for compliance and
usability)

-> Money & Time Zone Factor (Standards)

Hence a lot of effort needs to put in for Test Planning and Test Design

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Road Map to
success – The
Eight Rule’s
Rule 1: Get familiar with Business

Rule 2: Get familiar with Tool

Rule 3: Have at least one real programmer in your team

Rule 4: Set some standards

* Naming standards
* Coding standards
* Environment standards
* Procedure for error and defect tracking system
* Documentation

Rule 5: Figure out what you are testing and keep simple

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>

Rule 6: Start with small mile stone

Rule 7: Modularize and build reusability into your scripts

Rule 8: Document Everything

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>

Automation Plan

Manual testing

Patch -1 Patch -2 Int.Build


Main Release
Hot Fix Hot Fix Hot Fix

Repeatable Scenario
Start Automation Auto . Pack
Scripting

New customization scenario

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Automation Frame
Work iCargo

Automation Tool

Data Set

Script (n)
Log
Action
Object Repository

Re-Usable Error handling


Action Checks / Verification
and
Functions Data Handling function
Report function

Application

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Training

Rational Functional Tester

Session – 1 (beginner)

Vijay Chowthri N
icargo – Automation Testing
Team
December 16, Copyright © IBS Software Services. All Rights Reserved
TRAINING
<Title of the Presentation>
Agenda ( Session – 1 )

Introduction to Rational functional Tester

Features

Advantages

Risks and Best Practices

Create Rational Test Project

Configure Test Application

Start Script Recording

Capture Data Pool Fields


Capture Verification Points
Playback Test Script and View Log

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 12
TRAINING
<Title of the Presentation>

System Requirements

Processor : Pentium- 4 , 1.4 + GHz


RAM : Min 500 MB Recommended 1GB
OS : Win 2x, XP.
Hard Disk Space : 500MB

December 16, Copyright © IBS Software Services. All Rights Reserved


TRAINING
<Title of the Presentation>
Introduction

Object-oriented automated testing tool that tests


Java, HTML, VB.NET, and Windows applications.

Available in two integrated development


environments and two scripting languages Java and
VB.NET

Perform full functional testing. Record and play


back scripts that navigate through the application
and test the state of objects through verification
points.

Create and edit simple and easy-to-read, object-


oriented test scripts.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 14
TRAINING
<Title of the Presentation>
Introduction

In addition to automatically recording test scripts,


Functional Test contains wizards for generating code, for
example, for automatically creating a verification point.

The object-oriented recording technology in Functional


Tester lets you generate scripts quickly by recording
applications against the application-under-test. Functional
Tester uses object-oriented technology to identify objects by
their internal object properties, not by screen coordinates. If
the location or text of an object changes, Functional Tester
can still find it on playback.

Back
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 15
TRAINING
<Title of the Presentation>
Features

Functional Object Map:


Since the test object map contains recognition
properties for each object, we can easily update the
recognition information in one central location. Any
scripts that use this test object map also share the
updated information.
Verification points:
The verification point captures object information
(based on the type of verification point) and stores it in a
baseline data file. The information will be the baseline of
the expected state of the object during subsequent
builds.
Platform Independence:
Functional Test features platform-independent and browser-
independent test playback.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 16
TRAINING
<Title of the Presentation>
Features

Data-Driven Tests:
Data-driven testing uses data from an external file,a
data pool, as input to a test. A data pool is a collection of
related data records that supplies data values to the
variables in a test script during test script playback.

Call Script:
While recording or editing a Functional Test script,
we can insert a call to a previously recorded script. This
lets us to avoid repeatedly recording similar actions on
the application-under-test by taking advantage of scripts
that already exist.
Wait For Existence:
Use to set a wait state for an object during playback
to check for its existence.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 17
TRAINING
<Title of the Presentation>
Features

Break Point:
A breakpoint causes the execution of a program
thread to suspend at the location where the breakpoint is
set. When a breakpoint is enabled, it will cause a thread
to suspend whenever the breakpoint is reached

Integration with Test Manager:


Functional Test is integrated with Rational Test
Manager, which enables us to record and play back a
Functional Test script from Test Manager.

Script Assure Technology:


Frequently changes applications UI can break tests,
Which embody assumptions about how to identify the
interface objects during playback Avoid increases in
maintenance overhead.
Back
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 18
TRAINING
<Title of the Presentation>
Advantages

Reduction of time – Data correlation

Reduction of Human Involvement / Errors

More Accurate

Less Maintenance

More Reliable

Reusable
Back

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 19
TRAINING
<Title of the Presentation>
Risks
Re-work on the recorded script happens if the
application under test is not stable.

The Testers must be well trained on the tool,


Business Knowledge to ensure effective Scripting
and testing.
RFT will take huge amount of system memory when
play back the scripts.

LOV selection is more complicate one.

Some basic script and OOPS knowledge needed to


ensure effective and optimised Scripting. (at least
one developer support Required)

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 20
TRAINING
<Title of the Presentation>
Best Practices For Basic Scripting

While recording avoid TAB positions, instead click


on the specific object, AVOID KEY BOARD.

Even though there is a default curser position, click


on the object explicitly

Avoid Clicking on the Calendar components, instead


type the values manually

Before Starting recording, Click on the initial


window from where the recoding needs to be
started

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 21
TRAINING
<Title of the Presentation>
Best Practices For Basic Scripting

Maintain the dedicated Application Server and DB.

If possible, communicate with developers for


component changes that had happened in the new
release so that it would be easier to trace those
position in the recorded scripts

Test Design, common objects map, common data


pool and component based scripting improve the
script quality.
Record the mandatory Fields only.
Back

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 22
TRAINING
<Title of the Presentation>
Create Rational Test Project

Select FILE-> NEW -> Rational Test Project from Main


Menu.

Enter the Project name and Select the Project


Location.
Click on the Finish button

Back
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 23
TRAINING
<Title of the Presentation>
Configure Test Application

Select Configure -> Configure Application for


Testing

Click on the “Add” button to configure another


Application

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 24
TRAINING
<Title of the Presentation>
Configure Test Application

Select Kind of Application as HTML then “Next”


button

Enter the URL of the Application http://n7043:7043/


icargo

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 25
TRAINING
<Title of the Presentation>
Configure Test Application

Click on the “Finish” Button

Back

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 26
TRAINING
<Title of the Presentation>
Start Script Recording

Select File -> New -> Functional Test Script Using


Recorder

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 27
TRAINING
<Title of the Presentation>
Start Script Recording
Select the Project in which the Script to be
recorded
Specify the Script name and Click on the “Next”
button

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 28
TRAINING
<Title of the Presentation>
Start Script Recording

Specify the Test Object Map, Helper Super Class


and Test Data pool

Specify the Data pool record selection order then


click on the “Finish” button

System will display a recording window

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 29
TRAINING
<Title of the Presentation>
Start Script Recording

Start application by clicking on the Button indicated


in the window displayed

Select the Application which has to be recorded

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 30
TRAINING
<Title of the Presentation>
Start Script Recording

Record the Application Functionalities as required

Click on the Stop button once recording has been


completed

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 31
TRAINING
<Title of the Presentation>

Back
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 32
TRAINING
<Title of the Presentation>
Capture Data Driven Commands

Select the script in which the Data Driven


commands to be inserted

Select Script-> Insert Data Driven Commands

Make sure the Application should be running for


capturing Data driven commands

Press and Drag the Hand icon to select the Test


objects from the “Insert Data Driven Actions” pop
up displayed

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 33
TRAINING
<Title of the Presentation>
Capture Data Driven Commands

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 34
TRAINING
<Title of the Presentation>
Capture Data Driven Commands

Select the objects from Application for which Data


Driven commands required

Captured details of the selected objects will be


displayed in the “Insert Data Driven Actions” pop
up screen

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 35
TRAINING
<Title of the Presentation>
Capture Data Driven Commands

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 36
TRAINING
<Title of the Presentation>
Capture Data Driven Commands
Click on the “Ok” button if the Data capture
Completed

Back
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 37
TRAINING
<Title of the Presentation>
Capture Verification Points

Select the script in which the Verification Points to


be inserted

Select Script-> Insert Verification points

Make sure the Application should be running for


capturing Verification Points

Press and Drag the Hand icon to select the Test


objects from the “Verification Point and Action
Wizard” pop up displayed

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 38
TRAINING
<Title of the Presentation>
Capture Verification Points

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 39
TRAINING
<Title of the Presentation>
Capture Verification Points

Select the objects from Application on which


Verification Point required

Select the action to perform against the selected


object, then click “Next” button

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 40
TRAINING
<Title of the Presentation>
Capture Verification Points

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 41
TRAINING
<Title of the Presentation>
Capture Verification Points
Enter the Data Value, Verification Point Name, Max
Retry Time and Retry interval, then click on the
“Next” button.

N
ext

Check for the properties of the object to include in


the verification point, then click on the “Finish”
button.
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 42
TRAINING
<Title of the Presentation>
Capture Verification Points

Back

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 43
TRAINING
<Title of the Presentation>
Playback Test script and View Log

Select the Script which has to be played.


Select Script-> Run from the main menu.
Specify the Log name , then Click on the “Next”
button

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 44
TRAINING
<Title of the Presentation>
Playback Test script and View Log

Specify the Run Arguments and Data pool Iteration


Count.
Click on the “Finish” button.

Play Back status pop up screen will be displayed.


This screen will be closed automatically after
completing all the actions specified in the Script
currently playing

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 45
TRAINING
<Title of the Presentation>
Playback Test script and View Log

Rational Functional Tester will display the Log file


automatically once after completion of the script
running,if defaulted in the settings.

Script passed or failed information will be available


in the Log file.

Verification point Result can be verified from the


Log displayed

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 46
TRAINING
<Title of the Presentation>
Playback Test script and View Log

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 47
TRAINING
<Title of the Presentation>

&
Q U E S T I O N S
A N S W E R S

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 48
TRAINING
<Title of the Presentation>

Rational Functional
Tester

Session - 2

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 49
TRAINING
<Title of the Presentation>
Agenda ( Session
-2)

Understanding Test
Objects
Understanding Test
Datapool

Test Objects Capture

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 50
TRAINING
<Title of the Presentation>

Understanding Test Objects

A Test Object in represents a connection point between the


script that is playing back and the Software Under Test (SUT).
There is a corresponding object that exists in the SUT for the Test
Object that exists in the RFT script.

In the normal course of action statements are recorded and


objects are added to the Object Map.

The Object Map contains information that the script can then
use to construct and find a Test Object When something like
Button().click() is recorded the Button() method finds an object
based on mapped properties and then “binds” the Test Object to
an object in the SUT.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 51
TRAINING
<Title of the Presentation>

Understanding Test Objects

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 52
TRAINING
<Title of the Presentation>

Private Test
Objects

Test
Objects
Common /
Shared Test
Objects

Private Test object Associate with single scripts.

Shared single object map associated with multiple Scripts,


( advisable implementation)

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 53
TRAINING
<Title of the Presentation>
Create Common Test Objects

Add New Test object map, by using left click of mouse, (or)
Select
From Menu File >> New >> Test Object Map

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 54
TRAINING
<Title of the Presentation>

Sharing The Test Objects with Scripts

Add New Script, by using left click of mouse, (or) Select


From Menu File >> New >> Empty Functional Test Script
>>>Click Next
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 55
TRAINING
<Title of the Presentation>
Sharing The Test Objects with
Scripts

>> Browse the test object map and assign the Shared Test
Object with this script.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 56
TRAINING
<Title of the Presentation>

>> Create new script (Script2) share the Test object Map

>> Extend the Script1 class in Script2 & start use the Script1
object / Scripts

Example ::

public class Script2 extends Script1


{
/**
* Script Name : <b>Script2</b>
* Generated : <b>Sep 24, 2008 2:27:11 PM</b>
* Description : Functional Test Script
* Original Host : WinNT Version 5.1 Build 2600 (S)
*
* @since 2008/09/24
* @author a-2778
*/
public void testMain(Object[] args)
{
text_username().click();
}
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 57
TRAINING
<Title of the Presentation>

Understanding Test Datapool

A datapool is a test dataset, a collection of related data records


which supplies data values to the variables in a test script during
test script playback.

Datapools use to supply realist data and to stress an application


with a realistic amount of data.

Datapool
Feature To add realistic data to a test script

To import / Export data from a Functional Tester datapool, an IBM®


Rational® Test Manager datapool, or a .csv file created using a
spreadsheet application.
To create a datapool manually and add data to a datapool

To edit datapool values or change data types

To change the datapool record selection order to


determine how the test script accesses an associated
datapool during playback.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 58
TRAINING
<Title of the Presentation>

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 59
TRAINING
<Title of the Presentation>

Private Test
Datapool
Test Datapool

Common / Shared
Test Datapool

Private Test Datapool data's usable with in the single


scripts.

Shared Test Datapool data's can be shared with multiple


Scripts.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 60
TRAINING
<Title of the Presentation>
Create Common Test Datapool

Add New Test Datapool, by using left click of mouse, (or)


Select
From Menu File >> New >> Test Test Datapool
we can create Table Name (variable name) and add
multiple Record. (Left click on the Datapool to access this
option)
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 61
TRAINING
<Title of the Presentation>
Access Shared Datapool in the
Script
Associate Scripts with data pool

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 62
TRAINING
<Title of the Presentation>
Insert New Object (Another
Method)
Create a new Script

Double Click on the Private / Shared Test Object in the


Script Explorer

Click the Test Object Button


December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 63
TRAINING
<Title of the Presentation>

>> Drag the hand button and


select the object and click
Finish Button.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 64
TRAINING
<Title of the Presentation>

>> Click Save


>> Click Add to Script button ( to add the object in to
scripts )
>> Close the Window
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 65
TRAINING
<Title of the Presentation>

Rational Functional
Tester
Session – 3
(Moderate)

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 66
TRAINING
<Title of the Presentation>

Agenda (Session -
3)

Data base Connectivity


(Oracle)

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 67
TRAINING
<Title of the Presentation>

Effective database testing with IBM Rational


Functional Tester

Automated database testing is faster and more reliable the traditional GUI-
based test automation.

Resource
Competence
Familiar with the basic SQL
commands
Hands of experience / Exposure in Manual DB
Testing
Have an interest in automating some of that
testing

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 68
TRAINING
<Title of the Presentation>

What Can be Test ?

• The types of database activity (insert, delete, update) that will be invoked
• When these transactions will occur within the application-under-test
• The calculations or processing rules used by the application
• Any time-critical transactions, functions, conditions, and possible causes of poor
performance

• Data fields to ensure proper data types


• For proper spacing and length
• Data formats that may not be enforced by a data type
• For duplicate data
• Reference data to ensure that the data you are expecting is there
• Data migration Test Phase

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 69
TRAINING
<Title of the Presentation>

DB Configuration in
RFT

>> Select “Properties” in the RFT Main


Menu

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 70
TRAINING
<Title of the Presentation>

>> In the Properties pop-up window select “Java Build path”


>> Select “Libraries” Tab
>> Click “Add External Jar” Button
>> Select the Oracle client / server JDBC connectivity Jar file <oracle9204 \\ jdbc
\\ lib>
>> Click “OK” Button
December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 71
TRAINING
<Title of the Presentation>

Driver Connectivity Class


Once the Driver Configuration Over , Create connectivity Class.

public class oraconnection {

public static Object connection;

public Connection connect() throws SQLException

Connection connection;
Driver driver = new oracle.jdbc.OracleDriver();

DriverManager.registerDriver(driver);

connection = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST


=(ADDRESS = (PROTOCOL = TCP)(HOST = n7355.IBSPLC.COM)(PORT = 1521)))(CONNECT_DATA = (SERVER =
DEDICATED)(SERVICE_NAME = ICTST)))", "USERNAME", "PASSWORD");

connection.setAutoCommit(true);

return connection;

}
public ResultSet query(String string) {

return null;

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 72
TRAINING
<Title of the Presentation>

Example
The sample script explains insert new user Details in the
DB , By using the connection class.

public void testMain(Object[] args)

oraconnection connection = null;

ResultSet results;

try

{
connection = new oraconnection();

logInfo("Connected");

results = connection.query("Select * from SHRAGTMST where AGTCOD LIKE 'A1001'");

}
catch (SQLException e)

{
logInfo("Connection Failed");

connection.close();

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 73
TRAINING
<Title of the Presentation>

Rational Functional
Tester

Advanced Scripting Approach

Demo Session - 4

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 74
TRAINING
<Title of the Presentation>

Agenda (Session -
4)
Best Practices

Architecture & Naming


conversion
Solution For Ambiguous Recognition

Usage of Swing in
RFT
Table value selection &
verification
Multiple Object Recognition with reference of single object or
table properties.
Exception
handling
DB Migration Testing Approach (In
iCargo)
Manual & Dynamic Verification Point
Test Object handling & Optimization
Technique

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 75
TRAINING
<Title of the Presentation>
Automation Approach

Well Defined Testing Goal / business Scenario


improve the Test Automation

Development plan / Resource Plan / Common


understandable Naming conversion
* At least one developer should be in the
team

Manual Practice mandatory before scripting, this


help us to segregate the component level scripting
activity , improve re-usability of script and
optimized scripting approach.

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 76
TRAINING
<Title of the Presentation>
RFT Architecture Approach in iCargo

Supporting Scripts

Logical / Non-screen Common Data


related Scripts pool

Menu
Module Level
Screen Level
Component Level

Class

Common
Test Suit (integrated Scripts
scenario)

Common Test
Objects

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 77
TRAINING
<Title of the Presentation>
Solution For Ambiguous
Recognition

public void testMain(Object[] args)


{
sleep(2);
ITestObjectMethodState testobjmethodstate = null;
RootTestObject roottestobj = getRootTestObject();
TestObject[]
testobj=roottestobj.find(atList(atDescendant(".class","Html.HtmlBrowser")));
int noofbrowsers=testobj.length;
int[] intarr=new int[100];
for(int b=0;b<noofbrowsers;b++)
{
intarr[b]=b;
}
for(int b=0;b<noofbrowsers;b++)
browser_htmlBrowser(testobj[b],DEFAULT_FLAGS).close();
System.out.println("No.of Closed IE"+testobj.length);
sleep(2);

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 78
TRAINING
<Title of the Presentation>
Swings In RFT

We are using swings for some exception handling at run, time

Adequate dataset up in the absence of base data in new DB in


runtime

Supporting for data migration


test

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 79
TRAINING
<Title of the Presentation>
public void testMain(Object[] args)
{
JFrame frame =new JFrame();
Object[] billingperiod = {"Weekly", "Monthly", "Bi-Monthly"};
//Pop-up input data
String billperiod = (String)JOptionPane.showInputDialog(frame,"Select The Billing Period ",
"Customized Dialog",JOptionPane.PLAIN_MESSAGE,null,billingperiod,"Weekly");
// Add Connection class here
try
{
//Insert into SHRAGTSETCUR
// ADD Table Insert Scripts here....
}
catch(Exception e)
{
System.out.println(e);
}
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 80
TRAINING
<Title of the Presentation>
Object – New approach

Object can be identify with out recording , by understanding the


object property

public void testMain(Object[] args)


{
RootTestObject roottestobj=getRootTestObject();
TestObject[]
usrname=roottestobj.find(atList(atDescendant(".class","Html.INPUT.text",".na
me","username")));
System.out.println(usrname.length);
for(int i=0;i<usrname.length;i++)
{
System.out.println(usrname[i].getProperties());
// Identify through object map
text_username(usrname[i]),LOADING).setText(“Vijay”);
//Identify through object property ,never required object capture or
recording...
usrname[i].setProperty(".value", "AKLARL");
}
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 81
TRAINING
<Title of the Presentation>

Identify Specific Value from Table / enable check box at


appropriate values

public void testMain(Object[] args)


{
ITestDataTable breakdownTable = (ITestDataTable)table_stationAllotment().getTestData("contents");
int r=breakdownTable.getRowCount();
int c=breakdownTable.getColumnCount();
int clickRow = 0;
int clickCol = 0;
for(int row = 0;row < r; row++){
for(int col = 0;col < c; col++){
if(breakdownTable.getCell(row,col)!= null){
if(breakdownTable.getCell(row,col).toString().trim().equalsIgnoreCase((valueof.said1).trim()))
{
clickRow = row;
clickCol = col;
break;
}
}
}
}
table_stationAllotment().click(atCell(atRow(atIndex(clickRow)),
atColumn(atIndex(clickCol))));
}
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 82
TRAINING
<Title of the Presentation>
External File Read and Write
Class
public class rw {
String retrICAR;
File currDir = new File("fsrw-read&wrirefiles");
String filepath = currDir.getAbsolutePath().trim();
//Function for writing to the file,
public void writeF(String newICAR,String fname) {
FileWriter fw;
try {
fw = new FileWriter(filepath+"\\"+fname);
fw.write(newICAR);
fw.close();
}
catch (IOException e){
}
}
// function for Reading from the file.
public String readF(String fname) {
try {
BufferedReader br = new BufferedReader(new FileReader(filepath+"\\"+fname));
retrICAR = br.readLine();
System.out.println(retrICAR);
br.close();
}
catch (IOException e1){
}
return retrICAR;
}
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 83
TRAINING
<Title of the Presentation>
External File Read and Write Class Usage in the
script

public void testMain(Object[] args)


{
FSRW.rw a=new FSRW.rw();
//Write in to text file
a.writeF("Myname", "name.txt");
//Read From text file
String NameID= a.readF("name.txt").trim();
String NameID1=
a.readF("name.txt").substring(0,3).trim();
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 84
TRAINING
<Title of the Presentation>
Simple Exception handling for Expected run time
application error Message !

public void testMain(Object[] args)


{
boolean NewAWB;
boolean errormsg;
boolean othrmsg;
NewAWB = html_msgDataSpn().exists();
errormsg = image_errorMessage().exists();
while ( ! NewAWB || errormsg )
{
if (!errormsg)
{
System.out.println("AWB already Captured");
button_clearbutton(ANY,LOADING).click();
}
else if (errormsg)
{
System.out.println("Found Error message");
image_errorMessage().click();
button_clearbutton(ANY,LOADING).click();
}
}
System.out.println("New AWB");
button_yesbutton().click();
}
}

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 85
TRAINING
<Title of the Presentation>

&
Q U E S T I O N S
A N S W E R S

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 86
TRAINING
<Title of the Presentation>

Thank You

December 16, IBS Software Services Pvt LtdCopyright © IBS Software Services. 87