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.
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
Create a default configuration using Message Broker Toolkit:
- Click on Help and select Welcome.
- Click on Get Started.
- Click on Default Configuration.
- 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:
- Launch Functional Tester (Eclipse IDE) and select the workspace if you have not yet configured a default workspace. Then click on Configure.
- Select Enable Environments.
- 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).
- Create
libjavaplugin_oji.soas 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. - To verify that the browser has been enabled with Functional Tester, launch Functional Tester and click Configure.
- Select Enable Environments for Testing.
- In the Enable Environments window, click on the Web Browsers tab, select Firefox, enable it, and set it as the default browser.
- Click Test and you should see a browser window like this:
Figure 1. Browser enablement test

- 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

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

- 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.
- 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

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

- Click Finish.
- Click Configure.
- Select Configure applications for testing.
- Add the Message Broker Toolkit executable as shown in Figure 6, and then click Finish:
Figure 6. Application Configuration Tool

- 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

- 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.sofile path while exporting theLD_PRELOADvariable in your profile:
Figure 8. 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:
TestObjectcontains 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
findparameter. 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.
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.
- 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.
- 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.
- If you are using an image as a verification point, you can set the image verification tolerance in the
ivory.propertiesfile in theRFT_installation_directory/bindirectory. Make the following changes in this file:- Set
rational.test.ft.image.use.tolerancetotrue - Set
rational.test.ft.image.tolerancebetween 0 and 100, depending on the tolerance level percentage that you require.
- Set
| Description | Name | Size | Download method |
|---|---|---|---|
| Code sample | WMBAutomation.zip | 7 KB | HTTP |
Information about download methods
- 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 Message Broker V7 information center
- WebSphere resources
- developerWorks WebSphere developer resources
Technical information and resources for developers who use WebSphere products. developerWorks WebSphere provides product downloads, how-to information, support resources, and a free technical library of more than 2000 technical articles, tutorials, best practices, IBM Redbooks, and online product manuals. - developerWorks WebSphere application integration developer resources
How-to articles, downloads, tutorials, education, product info, and other resources to help you build WebSphere application integration and business integration solutions. - developerWorks WebSphere business process management developer resources
WebSphere BPM how-to articles, downloads, tutorials, education, product info, and other resources to help you model, assemble, deploy, and manage business processes. - developerWorks WebSphere SOA and Web services developer resources
How-to articles, downloads, tutorials, education, product info, and other resources to help you design and build WebSphere SOA and Web services solutions. - Most popular WebSphere trial downloads
No-charge trial downloads for key WebSphere products. - WebSphere forums
Product-specific forums where you can get answers to your technical questions and share your expertise with other WebSphere users. - WebSphere on-demand demos
Download and watch these self-running demos, and learn how WebSphere products and technologies can help your company respond to the rapidly changing and increasingly complex business environment. - developerWorks WebSphere weekly newsletter
The developerWorks newsletter gives you the latest articles and information only on those topics that interest you. In addition to WebSphere, you can select from Java, Linux, Open source, Rational, SOA, Web services, and other topics. Subscribe now and design your custom mailing. - WebSphere-related books from IBM Press
Convenient online ordering through Barnes & Noble. - WebSphere-related events
Conferences, trade shows, Webcasts, and other events around the world of interest to WebSphere developers.
- developerWorks WebSphere developer 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.
- Trial downloads for IBM software products

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 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 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.




