Skip to main content

skip to main content

developerWorks  >  Rational  >

Test Rational ClearQuest applications with Rational Functional Tester

developerWorks
Document options

Document options requiring JavaScript are not displayed


My developerWorks needs you!

Connect to your technical community


Rate this page

Help us improve this content


Level: Intermediate

Stefan Hufnagl (hufnagl@de.ibm.com), Senior Consultant, IBM

26 Jul 2005

See the process of recording and running a simple functional test on a ClearQuest application. An example scenario is used to illustrate the concepts presented in this getting started article.

Editor's Note: This article was written using IBM® Rational® ClearQuest 2003 and IBM® Rational® Functional Tester 6.1 and 6.0.

Overview

IBM Rational ClearQuest is a highly configurable and customisable tool for change request management. With this tool, you can easily develop databases applications that are focused on special tasks. Developing ClearQuest applications depends heavily on the graphical user interface (GUI), and this is where automated testing can help. You can develop test scripts for common ClearQuest tasks, such as submit and state change. Modifying records testing and analyzing the results of the tests then becomes easy. An additional benefit of testing is that the ClearQuest developer can use the test scripts for presenting the application to a customer.

Because ClearQuest can be used with many different interfaces, it is necessary for developed applications to undergo extensive testing. Although the ClearQuest application should be tested in all GUIs (Windows, Unix, Web, Eclipse), this article is focused on testing in only two environments: the new ClearQuest Web interface and the native Windows client. Using two separate examples, this article describes how to automate the testing in these two environments using IBM Rational Functional Tester. We chose to use Rational Functional Tester because it seems to more easily recognize GUI objects than Rational Robot. The same is true for the native Windows client.



Back to top


Prerequisites

To perform the tests in the examples, you must complete the following steps:

  1. Download Rational Functional Tester and Rational ClearQuest. If you don't already own the tools, you can download the trial versions.
  2. Install Java RunTime Environment on your machine.
  3. Install the .Net Framework. You must install this framework in order to test the GUI from Windows.
  4. Start Product Update to install Rational Functional Tester Interim Fixes.

Figure 1. Downloading product updates
Downloading product updates from Programs


Back to top


Acceptance Tests with Rational Functional Tester and the Rational ClearQuest Web Interface

This example shows how to create an acceptance test using Rational Functional Tester and the Rational ClearCase Web Interface. To prepare your machine for setting up the test script, complete the following steps:

  1. Start Rational Functional Tester by selecting Start> Program> IBM Rational> Rational Software Development Platform.
  2. Accept the default workspace.
  3. Close the Welcome Screen.
  4. Create a new Test Project by selecting File> New> Functional Test Project.
  5. Name the new project CQWebSample.
  6. If you want to use IBM® Rational® TestManager with Rational Functional Tester, then use the Rational Administrator wizard before creating a new Test project.
  7. Choose the Test Perspective if you do not see your test view.

Prepare Functional Tester to test the application

  1. Click Configure> Configure Applications for Testing.
  2. Select Add…, then choose HTML Application.
  3. Type in the URL of your CQ Webinterface. The result should look like this:

Figure 2. Application Configuration Tool
The application will be listed under Applications on the left side of the Application Configuration Tool

Start ClearQuest Web and record your first script

Instead of recording one large script that covers every activity, it is wiser to build several smaller scripts (modular). This means that you will create a separate script for login, log off, submit defects, queries and so on. In this first script you will record only the login procedure.

  1. Record your first Script by either selecting Script> Add Script Using Recorder or by clicking the right mouse button on your Test Project.
  2. Name the script CQWeb_Login and click Finish to start recording. The scripting environment minimizes and the recording toolbar displays. Note: Before going to the next step, please make sure your ClearCase Webservices (RWP) is still running
  3. Click Start Application on the recording toolbar. It is the third icon from the left, and looks like a window behind a green triangle.
  4. The Start Application window appears. Select your CQWeb Application and click OK to launch the application.
  5. The CQ Web Login Screen opens. The application should look like this:

Figure 3. Login screen
The Login screen with Username, Password, and Schema Respository fields
  1. Log in as admin, select SAMPL from the list and click Go.
  2. Stop recording by clicking the Stop Recording button.
  3. The result appears in Rational Functional Tester.

Figure 4. The recorded script
The recorded script appears in Rational Functional Tester.
  1. Congratulations, you have recorded your first script in Rational Functional Tester!

Playback of the recorded script

To play back the recorded script, close the ClearQuest Web window.

  1. Click the Run button.
  2. Then click the Finish button.
  3. Wait while the script processes.
  4. The successful result should display in a new window, as shown here:

Figure 5. The result
Playback window with list_schema().click displayed
  1. Review the result inside TestManager.

Figure 6. The result in TestManager
The result displayed in TestManager with Pass status
  1. Create a Logoff script.

Extended script usage

For ease of maintenance and scalability, it would be reasonable to use several scripts. You could create a separate script for each of the following:

  • Log in
  • Log off
  • Core Workflow (Submit, Assign, Open, Close)
  • Creating Child

But how do you control and use the modular scripts? You can use a main script and insert the necessary scripts. To insert the scripts into the main script, review the following figure:


Figure 7. Inserting a script
Inserting a script into the main script

The result should look like this:

		
public class MainScript extends MainScriptHelper
{
	/**
	 * Script Name   : MainScript
	 * Generated     : Mar 22, 2005 8:47:22 PM
	 * Description   : Functional Test Script
	 * Original Host : WinNT Version 5.0  Build 2195 (S)
	 * 
	 * @since  2005/03/22
	 * @author Administrator
	 */
	public void testMain(Object[] args) 
	{
		callScript("CoreWorkflow.Login");
		callScript("CoreWorkflow.Submit");
callScript("CoreWorkflow.LogOff");
	}
}

Using Verification Points with Regular Expressions

Verification Points are very important, without them your test scripts do not have meaningful results. The next example uses a verification point with Regular Expressions. With the help of regular expressions, verification points turn from static to dynamic.

Before starting the ClearQuest example, an explanation of Regular Expression is needed. A Regular Expression is a formula for matching strings that adhere to a particular pattern. Regular Expressions are very powerful when used in Rational Functional Tester, but can sometimes be hard to understand. For more information about Regular Expressions, visit "A Tao of Regular Expressions."

After submitting a defect in Rational ClearQuest, you should receive a confirmation similar to the following figure. You could use this confirmation as a Verification Point, but you should be careful. The next time you replay the script the confirmation looks the same, except for the defect number. It is here that a Regular Expression takes place.


Figure 8. Confirmation of defect submission
Confirmation that defect submission was saved

How do you verify this ClearQuest result message in Rational Functional Tester?

  1. Drag and drop a verification point from the recorder to the Web interface.
  2. Draw a red rectangle around the result text.

Figure 9. Viewing the verification point
viewing the verification point within Functional Tester
  1. Choose Perform Data Verification Point in the Verification Point Wizard and click Next.
  2. Remember to change the Data Value to Visible Text.
  3. Click the Convert Value to Regular Expression icon.
  4. Also click the Evaluate Regular Expression icon.
  5. As mentioned before, Regular Expressions are a universal notation for pattern matching. The Regular Expression evaluator allows you to test your regular expressions to make sure they is correct. In the Pattern field of the Regular Expression evaluator, replace the number 10 with the regular expression [0-9]{2}. That expression directs the test to match any two-digit combination of zeros and nines, or the range 00-99.
  6. Click Evaluate to test your regular expression. You should see the text Match in green show up in the Result field.
  7. When you are finished, click OK to close the window.
  8. Click Finish to close the Verification Point and Action Wizard.
  9. Exit your ClearQuest Web interface and stop recording.
  10. After replaying the newly created script, your HTML log should look like the following figure:

Figure 10. HTML log
HTML log


Back to top


Functional Tests with the native ClearQuest Windows Client

Working with the native ClearQuest Windows Client is very similar to working with the ClearQuest Web interface. For this reason, we only mention the differences in this example. Please note: You can't use Rational Functional Tester with native ClearQuest without the .Net Runtime.

  1. Start Rational Functional Tester by selecting Start> Program> IBM Rational> Rational Software Development Platform.
  2. Accept the default workspace.
  3. Close the Welcome Screen.
  4. Create a new Test Project by selecting File> New> Functional Test Project.
  5. Name the new test script CQSample.

Follow these steps to prepare Functional Tester to test ClearQuest:

  1. Select Configure> Configure Applications for Testing.
  2. Select Add, then choose Executable or Batch File. Type in the location of clearquest.exe. The result should look like this:

Figure 11. The Application Configuration Tool
The Application Configuration Tool showing application information such as Name, Kind, and Path


Back to top


Summary

Despite the rumors that it is impossible to use Rational Functional Tester for testing the GUI of Rational tools like ClearQuest, the examples in this article show how simple it is. The examples in the article showed you how to:

  • Create a submit script that is resilient to application changes-- a script that ran without modification on two different builds of the same application.
  • Validate dynamic data using pattern-matching regular expressions.

These examples only begin to show you what Functional Tester can do. I plan to write a follow-up article that shows the power of the object map and takes a closer look at Rational Functional Tester Java Code.

Hopefully, you now have the skills to try Rational Functional Tester on your own ClearQuest application code, in your environment. Best of luck!



Back to top


Acknowledgements

Thanks to André Kofaldt for all the technical support he gave me, and to Dr. Sternkicker for reviewing and providing thoughts on the paper.



Resources



About the author

Stefan Hufnagl is currently a Senior Consultant in the Rational Software Group at IBM, supporting the ClearCase, ClearQuest, and Functional Tester product lines. He has experience in the areas of Configuration and Change management, technical marketing, and software testing. He has been working with the Rational tools since 1998.




Rate this page


Please take a moment to complete this form to help us better serve you.



 


 


Not
useful
Extremely
useful
 


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!



Back to top