Test Automation using RFT

Still I’m in ma early  days of ma work at virtusa, I’m working on a IBM Project and to start with I have been asked to write test scripts to automate IBM Information Server using RFT (Rational Functional Tester). Which really is an intersting frame work. As usual I have been playing around with it for almost two or three days just to get the grip over it. And now I think I’m in the driving seat.

The frame work can be used to test any web page or any software’s GUI(Graphical User Interface). I really don’t know the possibility of checking CLI’s with it. So it’s upto you to check on and if inform me if there’s a possibility to do that as well.

At the heart of RFT is three main components namely appobjects, tasks and test cases. Where as tasks can be further sub devided into two important catagories UIChecker and UIOperations.

As a starting point I thought of using ony appobjects and do a simple automation that will open up your browser, go to google and perform a search operation on it to automatically fetch you the results.

If you are too interested buddy in this like me, first thing would be to download IBM RFT of which you should be able download a trial copy free of charge, cool..! and then launch your RFT which will look quite the same as an eclipse IDE if you have worked on it. Now all wot you need to do now is to start your new Project and write click on your root folder and select Add Empty Script. which will give you the file you gonna work with. below I will share my first code that does what I have mentioned above.

But before you do that you have to capture the search button object on the google website. Which you can do by double clicking on Private Test Object Map on the right side panel of your RFT workspace. And select Insert Object in the resulting window. You just need to drag the hand marked button and point the button on the google site at this point please note that same applies to the text input field as well. Then you right click on the object and select add to TestScript.YourProject. That’s it now back to businees end of life..

package appobjects;

import resources.appobjects.GoogleProjectHelper;

import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
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.*;

/**
 * Description   : Functional Test Script
 * @author HHameem
 */
public class GoogleProject extends GoogleProjectHelper
{
 /**
  * Script Name   : <b>GoogleProject</b>
  * Generated     : <b>Jul 11, 2008 6:03:08 PM</b>
  * Description   : Functional Test Script
  * Original Host : WinNT Version 5.1  Build 2600 (S)
  *
  * @since  2008/07/11
  * @author HHameem
  */
 public void testMain(Object[] args)
 {
  startBrowser(“http://www.google.com“);
  text_q().setText(“Lonely Coder”);
  button_googleSearchsubmit().click();
 }
}

Now you will be getting the same results page exactly as the one you get when you search “Lonely Coder” on google(Which is obviously my favourite search criteria on Google) manually. Hope you will find it interesting.

Advertisements