Top Banner
Implementing the ITCL (or IBM) Framework using Rational Functional Tester Aarti Goel ([email protected] ), Senior Software Engineer, IBM India Pvt. Ltd. Summary: The article explains a five step process for implementing the ITCL framework using Rational Functional Tester, in order to automate the functional tests of an application. Tag this! Update My dW interests (Log in | What's this? ) Skip to help for Update My dW interests Date: 22 Aug 2006 Level: Intermediate Activity: 1654 views Show articles and other content related to my search: itcl framework Show descriptions | Hide descriptions Introduction There are many forums and communities that define the IBM framework (or ITCL framework): what it is, how it works, and its underlying advantages. The objective of this article is to focus on the implementation of the IBM framework. It will define how the IBM framework can be implemented while using IBM® Rational ®Functional Tester for automating the functional tests of an application. Back to top
15
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: RFT- ITCL

Implementing the ITCL (or IBM) Framework using Rational Functional TesterAarti Goel ([email protected]), Senior Software Engineer, IBM India Pvt. Ltd.

Summary:  The article explains a five step process for implementing the ITCL framework using Rational Functional Tester, in order to automate the functional tests of an application.

Tag this!Update My dW interests (Log in | What's this?) Skip to help for Update My dW interests

Date:  22 Aug 2006 Level:  Intermediate Activity:  1654 views

Show articles and other content related to my search: itcl framework

Show descriptions | Hide descriptions

Introduction

There are many forums and communities that define the IBM framework (or ITCL framework): what it is, how it works, and its underlying advantages. The objective of this article is to focus on the implementation of the IBM framework. It will define how the IBM framework can be implemented while using IBM® Rational ®Functional Tester for automating the functional tests of an application.

Back to top

The framework

The IBM framework, formerly known as the ITCL framework, was developed by the Quality Software Engineering team in collaboration with experienced automation teams throughout IBM. The framework consists of a three-tiered architecture implemented through the appobjects, tasks, and test cases packages (the IBM package).

The principles underlying the appobjects, tasks, and test cases packages are:

Layered architecture

Page 2: RFT- ITCL

Separation of the "what" from the "how" Code reuse Consistent and clear organization Ability to ramp up quickly Quick debugging Organize files effectively Enabling collaboration Learning from others

Here's an explanation of appobjects, tasks, and test cases:

AppObjects: where you will store information about your application’s GUI elements. It is also where you will write your Getter Methods, which return objects enabling the Caller to query and manipulate these GUI elements. Typically, these methods are called within the Task layer.

Tasks: where you will write reusable methods that exercise common functions in your application. It is also where you will write methods to manipulate and query complex, application-specific controls. Methods in the Task are called by Test Cases.

Test Cases: methods that navigate through an application, verify its state, and log results.

Back to top

Implementation methodology

The methodology outlined in this section defines a 5-step procedure to implement the IBM framework.

STEP 1. First, create a new project on your local drive. The project will have a repository in which you can store, maintain, compile, and run your automation code. In Functional Tester, select File > New > Functional Test Project. Name your project and click Finish.

STEP 2. Import the IBM package -- which contains utility classes that will be used extensively in the automation scripts -- into your project. Although it is possible to simply relate the path to the ibm.jar file, importing the IBM package into your project will make it easier for you to examine the package’s contents, and step into the package later when debugging. The IBM package can be downloaded from the download table at the bottom of this article.

Importing the ibm.jar package

Page 3: RFT- ITCL

1. In IBM Rational Functional Tester, go to the Projects view on the left side of your screen and click on the project created in STEP 1.

2. Select File > Import. Select Zip file and click Next. Use the Browse button to find the ibm.jar or ibm.zip file in the location you chose to store the file.

3. Leave all settings at their default and click Finish. 4. You should now be able to expand the name of your project in the Functional Test

Projects view. You should see a folder underneath it called ibm.

STEP 3. Create a package called AppObject.

1. In Rational Functional Tester, go to the Projects view on the left side of your screen and click on the project created in STEP 1.

2. Pick File > New > New Test Folder.3. Name the folder AppObject.4. Click Finish.5. Repeat Steps 1-4 to create Tasks and TestCase folders too.

What is an AppObject Package?

In this package you have to map all the objects of the application under test. A general recommendation is to prepare separate scripts for each screen to ensure better re-use and organization of the objects and classification. For example, create a script called login that will keep all objects related to the login screen. You can also create others related to sent, inbox screens, and so on.

Working with the AppObject folder

1. Create an empty script in the AppObject Package.2. Select the AppObject package, Right-click and select Add Empty Script, as

shown in Figure 1.

Page 4: RFT- ITCL

Figure 1. Adding an empty script

3. Specify the name as Login and click Finish4. From the script explorer double-click Private Object Map.5. Make sure that the mail.yahoo.com site (or the application under test) is open.6. From the Private Object map, click on Test Object > Insert Object(s), as shown

in Figure 2.

Figure 2. Inserting a test object

7. Drag the hand icon tool from the below dialog to the object that you want to map, as shown in Figures 3 and 4.

Figure 3. Selecting an object by dragging it

Page 5: RFT- ITCL

Figure 4. Object selected

8. Click Finish.9. Your Private Object Map screen should look like that shown in Figure 5.

Page 6: RFT- ITCL

Figure 5. Completed Private Object Map

10. Select the object you recently added, right-click it, and select Add to Script AppObject.Login.

11. Repeat steps 6-10 for all objects you want to add into this script.12. Click File > Save from the Private Test Object and close this. Your script

explorer should look like that in Figure 6.

Figure 6. Script Explorer for Login

13. Similarly, you can create as many scripts as you want to add into the project, and add the related objects as well.

Page 7: RFT- ITCL

Generating AppObjects code automatically

Once you have added your objects to your object maps, you can generate your getters automatically by writing a few lines of code. These getters help you to access the objects across/with in project added in the script. You will create an empty script within the AppObject folder, and write the code shown in Listing 1 to generate the getter automatically.

1. Create an Empty Script called getter within the AppObject folder.2. Create the code in Listing 1.

Listing 1. Code to generate getters automatically

//IMPORT THESE 2 STATEMENTS AT THE TOP OF SCRIPTimport java.util.Vector; import ibm.tools.ClassGenerator;//WRITE DOWN THE BELOW CODE IN TESTMAIN FUNCTIONpublic void testMain(Object[] args)

{Vector v = new Vector();v.addElement (new AppObject.Login ());

//ADD ELEMENT FOR ALL THE SCRIPTS YOU HAVE IN YOUR AppObjectnew ClassGenerator().updateScripts(v);

}

3. Your Getter script contents should look like that shown in Figure 7.

Page 8: RFT- ITCL

Figure 7. The Getter script

4. Run the script by selecting Script > Run.5. After running once, when you click your Login script it will ask you if you want

to load the changes.6. Click Yes and you should see that your Login script has the Getter function, as

shown in Figure 8.

Figure 8. Login function with the Getter script

STEP 4. Creating tasks

A task is the place where you will write the most reusable complex code.

1. First Create a Script within the Tasks folder (as you did previously in the AppObject Folder).

2. Select the Tasks folder. Right-click it and select Add Empty Script.3. Specify the name and click Finish.4. Insert the code in Listing 2 into the script.

Page 9: RFT- ITCL

Listing 2. Login task

//DECLARE THE OBJECT OF THE SCRIPTS EXIST IN APPOBJECT public AppObject.Login lgn = new AppObject.Login();….….public AppObject.Login lgn = new AppObject.Login();

public void AssignLoginInfo(){

lgn.getText_login().setText("abc");lgn.getText_passwd().setText("New1");

}

public void testMain(Object[] args) {}

5. Your script contents should look like that shown in Figure 9.

Figure 9. Amended script contents

6. You can add as many functions as required in the same script, or in new script(s) as per the application requirements.

Next, you are going to automate these functions.

STEP 5. Creating Test Cases

In Test Cases, you write the actual steps to perform the action. This will inherit the properties from the Tasks and the Appobject.

1. First create a script within the Tasks folder (as you did previously in the AppObject folder).

2. Select the Tasks folder. Right-click it and select Add Empty Script.3. Specify the name and click Finish.

Page 10: RFT- ITCL

4. Insert the code shown in Listing 3 into the script.

Listing 3. Test case

//DECLARE THE OBJECT OF THE SCRIPTS EXIST IN TASKS //OBJECT CREATION OF TASKS LOGINTASK SCRIPT

public Tasks.LoginTask lt = new Tasks.LoginTask();….….public void testMain(Object[] args) {

//INVOKING THE BROWSERstartBrowser("mail.yahoo.com");//ASSIGNED THE USER NAME AND LOGIN INFOlt.AssignLoginInfo();//CLICKED ON LOGIN/SUBMIT BUTTONlt.lgn.getButton_signInsubmit().click();//FURTHER ACTION CAN BE WRITTEN ACCORDIUNLGY

}

5. Your script contents should now look like those shown in Figure 10.

Figure 10. Final script

Page 11: RFT- ITCL

6. Now run the script. it should open the browser, enter the user name and password, and then login into the Yahoo account.

Back to top

Summary

The IBM framework can be implemented by following the five steps outlined in this article. The examples and code snippets herein are relevant to Rational Functional Tester. These may vary depending on whether other implementations of the IBM framework are using another tool.

Back to top

Download

Description Name Size Download methodIBM package files ibm_package.zip 551 KB HTTP

Information about download methods

What's this?This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Page 12: RFT- ITCL

Close [x]

Help: Remove from My dW interests

What's this?Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/SITE_ID=1Zone=RationalArticleID=154320ArticleTitle=Implementing the ITCL (or IBM) Framework using Rational Functional Testerpublish-date=08222006author1-email=aartgoel@in.ibm.comauthor1-email-cc=

url=http://www.ibm.com/developerworks/rational/library/06/0822_goel/

Table of contents

Introduction The framework Implementation methodology Summary Download Resources About the author Comments

Next steps from IBM

Try: Rational Functional Tester