Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Automating WebSphere Message Broker Toolkit operations using Rational Functional Tester

Avinash Jhawar (avjhawar@in.ibm.com), Staff Software Engineer, IBM
Photo of Avinash Jhawar
Avinash Jhawar has more than seven years of experience in software testing and development. He currently works on the WebSphere Message Broker team. You can contact Avinash at avjhawar@in.ibm.com.
Pabitra Mukhopadhyay (pabmukho@in.ibm.com), Software Engineer, IBM
Photo of Pabitra Mukhopadhyay
Pabitra Mukhopadhyay has more than five years of experience in IBM mainframe (System z) environments, with experience in application development, enhancement, and testing. He currently works on the WebSphere Message Broker team. You can contact Pabitra at pabmukho@in.ibm.com.
Ravi SK Sinha (ravssinh@in.ibm.com), Software Engineer, IBM
Photo of Ravi Sinha
Ravi SK Sinha has two years of experience in automation and development of software products at IBM. He currently works on the WebSphere MQ JMS Level-3 Support team. You can contact Ravi at ravssinh@in.ibm.com.

Summary:  This article shows you how to use Rational Functional Tester to automate WebSphere Message Broker Toolkit operations. Topics include configuring the Eclipse-based Message Broker Toolkit with the Functional Tester Eclipse IDE, importing and deploying Message Broker sample scripts, and troubleshooting.

Date:  12 Oct 2011
Level:  Intermediate
Also available in:   Chinese  Portuguese

Activity:  7258 views
Comments:  

Introduction

IBM® WebSphere® Message Broker (hereafter called Message Broker) supports the transformation and routing of messages between business applications, and it includes a Toolkit for business flow development and deployment.

IBM® Rational® Functional Tester (hereafter called Functional Tester) is a test tool that helps you automate functional, regression, GUI, and data-driven testing. This article shows you how to use Functional Tester to automate Message Broker Toolkit operations, and will cover the following topics:

  • Configuring the Eclipse-based Message Broker Toolkit with the Functional Tester Eclipse IDE
  • Sample scripts to demonstrate how to automate Message Broker Toolkit operations.
  • Troubleshooting

You can automate any Message Broker Toolkit IDE operation using Functional Tester. As an example, this article shows you how to automate the import and deployment of Message Broker samples provided in the Message Broker Toolkit.

Benefits of automating manual testing

In manual testing, it is often necessary to repeatedly execute the same test cases, which is error-prone as well as tedious and time-consuming. Automating testing with the Message Broker Toolkit can avoid these problems. The Toolkit enables you to create and deploy message flows to a Message Broker runtime. A large organization may develop and deploy thousands of business message flows, the business rules involved are subject to change depending on ever-changing requirements. You may need to test all of the business flows in order to prevent regression errors, for example when you are upgrading to a new version of Message Broker, or when new business requirements force a change in a message flow or its components or parameters.

Prerequisites

To benefit from this article, you should have some experience with Java™ coding, and you should have installed:

  • Rational Functional Tester V8.1 or later on Microsoft® Windows® or Linux® .
  • WebSphere Message Broker V7 and Message Broker Toolkit V7

Configuration

Create a default configuration using Message Broker Toolkit:

  1. Click on Help and select Welcome.
  2. Click on Get Started.
  3. Click on Default Configuration.
  4. On the Creating the Default Configuration page, click on Start the Default Configuration Wizard and then follow the steps in the Wizard.

Configure Functional Tester:

  1. Launch Functional Tester (Eclipse IDE) and select the workspace if you have not yet configured a default workspace. Then click on Configure.
  2. Select Enable Environments.
  3. Click on the Web Browsers tab. For Windows, Internet Explorer is added by default. If you are using Linux, install Mozilla Firefox V3.0.4 (you may run into compatibility issues if you use later version).
  4. Create libjavaplugin_oji.so as a softlink in /usr/lib/firefox-3.0.4/plugins/, pointing to the file
    /opt/IBM/SDP/jdk/jre/plugin/i386/ns7/libjavaplugin_oji.so:
    >cd /usr/lib/firefox-3.0.4/plugins/
    >ln -s /opt/IBM/SDP/jdk/jre/plugin/i386/ns7/libjavaplugin_oji.so 
    libjavaplugin_oji.so

    /usr/lib/firefox-3.0.4/plugins/ is the location where you installed Firefox V3.0.4.
  5. To verify that the browser has been enabled with Functional Tester, launch Functional Tester and click Configure.
  6. Select Enable Environments for Testing.
  7. In the Enable Environments window, click on the Web Browsers tab, select Firefox, enable it, and set it as the default browser.
  8. Click Test and you should see a browser window like this:

    Figure 1. Browser enablement test
    Browser enablement test

  9. Click Run Diagnostic Tests. After the browser enablement test has completed successfully, you should get the test result as PASSED:

    Figure 2. Browser enablement test result
    Browser enablement test result

    For Microsoft Windows, check the Internet Explorer enablement with Functional Tester in a similar manner as shown in Figures 1 and 2 above.
  10. Now click on the Java Environments tab:

    Figure 3. Enable environments: JRE
    Enable environments: JRE

  11. Enable the default JRE. If no JRE is visible, add and enable the system JRE as shown in Figure 3 above. IBM JRE V1.6 is preferred.
  12. Click Test to test the JRE configuration. You should see a pop-up like this, confirming the test result:

    Figure 4. JRE configuration test result
    JRE configuration test result

  13. Click on the Eclipse Platforms tab.
  14. Add and enable the Message Broker Toolkit Eclipse path, as shown in Figure 5:

    Figure 5. Enable environments: Eclipse
    Enable environments: Eclipse

  15. Click Finish.
  16. Click Configure.
  17. Select Configure applications for testing.
  18. Add the Message Broker Toolkit executable as shown in Figure 6, and then click Finish:

    Figure 6. Application Configuration Tool
    Application Configuration Tool

  19. After the configuration is completed, launch the Message Broker Toolkit and check whether the Functional Tester Test Object Inspector recognizes the Message Broker Toolkit application objects. See Figure 7 below for reference. Application software object recognition by the Test Object Inspector is required before proceeding further:

    Figure 7. Application Configuration Tool
    Application Configuration Tool

  20. You should always launch the application software under test through Functional Tester: Click on the Application menu of the Test Object Inspector window, as shown in Figure 8 below. But if you want to launch the software under test without using the Functional Tester menu, add the /opt/IBM/SDP/FunctionalTester/bin/libftevent.so file path while exporting the LD_PRELOAD variable in your profile:

    Figure 8. Launching application under test using Functional Tester
    Launching application under test using Functional Tester

Automating GUI operations using Functional Tester

There are several ways to automate GUI operations using Functional Tester:

  • Use hand coding.
  • Use Functional Tester Recorder to record and play back scripts: Functional Tester records user actions on the software under test, and you can play back this recorded script using Functional Tester. To record your own script, click on the Script Menu and then select Add Script Using Recorder.
  • Use the Functional Tester find() API or Root Finder method: You can write your own Java code in Functional Tester to automate GUI actions. The Root Finder method works based on the object properties of the software under test.

The script recording and playback method is easier and faster to implement, but it is highly dependent on screen resolution and screen coordinates. Therefore most recorded scripts are not directly portable to other machines, unless those machines are set up identically. Also, Functional Tester on Linux does not support script recording. You can use the Root Finder method to address these limitations and make your code robust and portable. This article focuses on using the Root Finder method to automate GUI actions.

Java code for Root Finder automation method

TestObject[] testObjects = null;
testObjects = root.find(RationalTestScript.atDescendant("<property1>","<value1>",
      ["<property2>","<value2>")]);
if (testObjects.length > 0) {
   RationalTestScript.logInfo("Log text goes here.....");
   GuiTestObject gto = new GuiTestObject(testObjects[0]);
   gto.waitForExistence();
   boolean b=gto.exists();
   if(b==true){
      gto.click();
   }
   gto.unregister();
else {
   RationalTestScript.logError("\n Error message");
   }
}

Explanation of this code snippet:

  • TestObject contains the references of a GUI object in Message Broker Toolkit:
    TestObject[] testObjects = null;

  • This line of code finds the GUI object based on the properties in the find parameter. The function accepts either one or two parameters as input:
    testObjects = root.find(RationalTestScript.atDescendant("<property1>","<value1>",
    ["<property2>","<value2>")]);

  • This line of code logs the information into the Functional Tester test log:
    RationalTestScript.logInfo("Log text goes here.....");

  • This line of code gets the reference of the object found by the root finder. This reference is used for GUI operations later in the program:
    GuiTestObject gto = new GuiTestObject(testObjects[0]);

  • This line of code waits until the object is created:
    gto.waitForExistence();

  • This line of code performs a left-click operation on the referenced object:
    gto.click();

  • This line of code de-references the object:
    gto.unregister();

There are different ways to verify intermediate results against a baseline. You can use programmatic handling of errors through exceptions, which has been used in the sample code provided with this article. You can also insert verification points in the code by selecting Script => Insert verification point.

Running the sample code

You can download sample Functional Tester code written in Java at the bottom of the article. This code launches the Message Broker Toolkit, imports and deploys the Address Book Sample, and then removes the sample from Message Broker and from the Message Broker Toolkit workspace. Unzip this file and import the .rftjdtr file into a new Functional Tester project as a Functional Test Project Item, then run the WMBAutomation script.

Troubleshooting

  1. If the Windows or Linux screen is locked automatically or by the user, Functional Tester will not be able to proceed. To overcome this limitation, install UltraVNC server on the test machine and then start the test run from another desktop using UltraVNC client.
  2. If Functional Tester is unable to recognize the objects quickly enough, you can vary the ScriptAssure Recognition level and Warning level: Select Window => Preferences => Playback => ScriptAssure.
  3. If you are using an image as a verification point, you can set the image verification tolerance in the ivory.properties file in the RFT_installation_directory/bin directory. Make the following changes in this file:
    • Set rational.test.ft.image.use.tolerance to true
    • Set rational.test.ft.image.tolerance between 0 and 100, depending on the tolerance level percentage that you require.


Download

DescriptionNameSizeDownload method
Code sampleWMBAutomation.zip7 KBHTTP

Information about download methods


Resources

  • WebSphere Message Broker resources
    • WebSphere Message Broker V7 information center
      A single Web portal to all WebSphere Message Broker V7 documentation, with conceptual, task, and reference information on installing, configuring, and using your WebSphere Message Broker environment.
    • WebSphere Message Broker developer resources page
      Technical resources to help you use WebSphere Message Broker for connectivity, universal data transformation, and enterprise-level integration of disparate services, applications, and platforms to power your SOA.
    • WebSphere Message Broker product page
      Product descriptions, product news, training information, support information, and more.
    • What's new in WebSphere Message Broker V7
      WebSphere Message Broker V7 provides universal connectivity with its ability to route and transform messages from anywhere to anywhere. Through its simple programming model and a powerful operational management interface, it makes complex application integration solutions much easier to develop, deploy, and maintain. This article describes the major enhancements in V7.
    • Download free trial version of WebSphere Message Broker V7
      WebSphere Message Broker V7 is an ESB built for universal connectivity and transformation in heterogeneous IT environments. It distributes information and data generated by business events in real time to people, applications, and devices throughout your extended enterprise and beyond.
    • WebSphere Message Broker documentation library
      WebSphere Message Broker specifications and manuals.
    • WebSphere Message Broker forum
      Get answers to your technical questions and share your expertise with other Message Broker users.
    • WebSphere Message Broker support page
      A searchable database of support problems and their solutions, plus downloads, fixes, and problem tracking.
    • Redbook: Patterns: SOA design using WebSphere Message Broker and WebSphere ESB
      Patterns for e-business are a group of proven, reusable assets that you can use to more quickly develop and deploy e-business applications. This Redbook shows you how to use WebSphere Message Broker with WebSphere ESB to implement an ESB within an SOA. Includes a scenario to demonstrate design, development, and deployment.

  • WebSphere resources
  • developerWorks resources
    • Trial downloads for IBM software products
      No-charge trial downloads for selected IBM® DB2®, Lotus®, Rational®, Tivoli®, and WebSphere® products.
    • developerWorks blogs
      Join a conversation with developerWorks users and authors, and IBM editors and developers.
    • developerWorks tech briefings
      Free technical sessions by IBM experts to accelerate your learning curve and help you succeed in your most challenging software projects. Sessions range from one-hour virtual briefings to half-day and full-day live sessions in cities worldwide.
    • developerWorks podcasts
      Listen to interesting and offbeat interviews and discussions with software innovators.
    • developerWorks on Twitter
      Check out recent Twitter messages and URLs.
    • IBM Education Assistant
      A collection of multimedia educational modules that will help you better understand IBM software products and use them more effectively to meet your business requirements.

About the authors

Photo of Avinash Jhawar

Avinash Jhawar has more than seven years of experience in software testing and development. He currently works on the WebSphere Message Broker team. You can contact Avinash at avjhawar@in.ibm.com.

Photo of Pabitra Mukhopadhyay

Pabitra Mukhopadhyay has more than five years of experience in IBM mainframe (System z) environments, with experience in application development, enhancement, and testing. He currently works on the WebSphere Message Broker team. You can contact Pabitra at pabmukho@in.ibm.com.

Photo of Ravi Sinha

Ravi SK Sinha has two years of experience in automation and development of software products at IBM. He currently works on the WebSphere MQ JMS Level-3 Support team. You can contact Ravi at ravssinh@in.ibm.com.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

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

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=1
Zone=WebSphere
ArticleID=765585
ArticleTitle=Automating WebSphere Message Broker Toolkit operations using Rational Functional Tester
publish-date=10122011

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers