Showing posts with label Rational Functional Tester. Show all posts
Showing posts with label Rational Functional Tester. Show all posts
Quick Notes About RFT (Rational Functional Tester)
0 comments Published by adel on Saturday, March 01, 2008 at 2:13 PMGood Things about RFT:
- Flexibility in terms of full access to object properties, controlling those properties in a very meticulous way which gives the ability to override unwanted recognition errors and increase application's immunity to changes in your AUT that should not be considered as fails. RFT is doing great here
- Since it works under eclipse, you have virtually unlimited ability to integrate useful java classes that recording and playback cannot do. Such as database accessibility, necessary looping and switching and even adding a nice sleeky UI.
Concerns about RFT:
- Unexpected crashes of the framework. This happened three times in less than 8 months. It happens in response to an eclipse update.
- Eclipse version effect on new scripts: New Scripts may not run until eclipse is update.
- Competition with other products such as QTP and open source tools such as Selenium and Selenium grid, which i am starting to like more and more.
- Flash and Flex plug-ins. Flash and flex support is available only in version 7 and above. My version is 6.1. Why isn't there a plug-in to support this?!
Enhance IBM Rational Functional Tester (RFT) with U.I Java Classes
5 comments Published by adel on Saturday, February 23, 2008 at 2:27 PMDisclaimer: This post is related to IBM Rational Functional Tester With Java. It needs some slight modifications to work with other tools.
Sometimes, your automated test script needs to do some strange stuff. Like accessing the database, extracting some value and using this value in subsequent U.I steps in your script.
Suppose that you have hundreds of scripts that needs the following block to access the DB and read a certain value:
try{What if the username and password is changed after a period of time for a certain reason. This means that you need to modify all your scripts and change the credentials. And this could be a pain and very time consuming.
Connection db_connection = DriverManager.getConnection("jdbc:odbc:DBNAME",
"username","password");
Statement stm2 = db_connection.createStatement();
stm2.executeQuery("select * from TableName");
}
catch( SQLException x ){
JOptionPane.showMessageDialog(null,
x.getLocalizedMessage().toString(),"Error",
JOptionPane.ERROR_MESSAGE);
}
A good practice is creating a class that will prompt the user to enter the credentials and validates them before running the script. This will save time and headache in subsequent releases.
The following is the code for the class with the proprietary information removed:
import javax.swing.JOptionPane;
import resources.SendValidUNandPWHelper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
/**
* Description : Functional Test Script
* @author Ashehadeh
*/
class SendValidUNandPW extends SendValidUNandPWHelper
{
/**
* Script Name : CheckDBDialog
* Generated : Feb 19, 2008 8:31:06 AM
* Description : Functional Test Script
* Original Host : WinNT Version 5.1 Build 2600 (S)
*
* @since 2008/02/19
* @author Ashehadeh
*/
/**
* @param args
*/
public String[] sendValidCredentials(){
String[] result=null;
String[] k =validateInput();
while (k==null){
k= validateInput();
}
return k;
}
//check if the provided credential can access the DB
public static String[] validateInput(){
String[] result=null;
String[] k =isDBonline();
if (k==null){
result =null;
System.exit(0);
}
else {
try{
Connection db_connection = DriverManager.getConnection("jdbc:odbc:DBNAME",k[0],k[1]);
Statement stm2 = db_connection.createStatement();
stm2.executeQuery("select * from TABLEName");
result =k;
}
catch( SQLException x ){
JOptionPane.showMessageDialog(null,
"Please Enter correct Uasername/Password!","Error",
JOptionPane.ERROR_MESSAGE);
/* JOptionPane.showMessageDialog(null,
x.getLocalizedMessage().toString(),"Error",
JOptionPane.ERROR_MESSAGE);*/
result=null;
}
}
return result;
}
//check if the db is online from the first place
public static String[] isDBonline(){
String[] result=null;
String[] k =isOneEmpty();
if (k==null){
result =null;
System.exit(0);
}
//now check for DB connectivity
else {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
result =k;
}
catch(ClassNotFoundException c){
JOptionPane.showMessageDialog(null,
"DB Unavailable!","Error",
JOptionPane.ERROR_MESSAGE);
result=null;
System.exit(0);
}
}
return result;
}
//is one of the fields empty? if so, exit
public static String[] isOneEmpty(){
String[] k=showDialog();
String[] result;
// if one of the username or passwords are empty, exit.
if (k[0]==null || k[1].equals("") ||
k[1].equals("") || k[1]==null){
JOptionPane.showMessageDialog(null,
"Error. Fill the two fields. Click ok to exit!","Error",
JOptionPane.ERROR_MESSAGE);
result=null;
System.exit(0);
}
//if both of them are not empty continue
else{
result=k;
}
return result;
}
//prompt the user for username and password
public static String[] showDialog() {
String DBUsername=JOptionPane.showInputDialog(null,
"Enter DB username:", "Input", JOptionPane.QUESTION_MESSAGE);
String DBpassword=JOptionPane.showInputDialog(null,
"Enter DB password:", "Input", JOptionPane.QUESTION_MESSAGE);
String[] UPArray={DBUsername,DBpassword};
return UPArray;
}
}






