Stubs made easier with Rational Integration Tester

Simplify integration testing even if you don't have all the necessary components

Integration testing can be challenging because — although all components of an application must be tested — not all components are necessarily available. With IBM® Rational® Integration Tester, a component of IBM® Rational® Test Workbench, you can create code-free, reusable, maintainable stubs, so testing can continue even if some components are missing. In addition, Rational Integration Tester provides comprehensive functional, regression, load, and integration testing to help reduce test cycle times and move integration testing earlier in the development lifecycle.

Pallavi V. Bhosale (pallavi.bhosale@in.ibm.com), Software Test Specialist, IBM

Pallavi Bhosale is a Software Test Specialist with India Software Labs. She joined IBM in 2010 as a Client Technical Professional and has helped diverse clients leverage IBM® Rational® software.



19 November 2013

Also available in Chinese

Stubs made easier with Rational Integration Tester

Integration testing means testing a user application across all components and service boundaries. Doing so, however, is not always easy.

Some components of the system might not be unavailable — perhaps a particular service is still in development. Services might be in use by others and can't be shared, or might be expensive to use. Opening up access to other services might expose private data to testers, and so those services aren't available to the test team.

If you stub out the system components, you can test that system without waiting for components to become available. However, testers traditionally have relied on developers to create these stubs. Usually the stubs aren't user-friendly, and there's little chance that you can reuse them. Additionally, maintenance is normally handled by the developers.

IBM® Rational® Integration Tester (part of IBM® Rational® Test Workbench) is a desktop solution designed to address the challenges of testing legacy or modern architectures by helping you:

  • Visualize the connections and dependencies between services and components to plan an integration test strategy
  • Stub out services that are unavailable for testing, making continuous integration testing possible and reducing the risk of errors in the application
  • Automate all aspects of integration testing

How integration testing works with Rational Integration Tester

The following steps detail how you can easily create stubs for integration testing using Rational Integration Tester.

Configuring Library Manager

Rational Integration Tester supports a wide variety of technologies — such as web services and email — out of the box. However, external libraries (or Java JAR files) are required for proprietary technologies. These libraries are supplied with the installation files of that software. Library Manager, the main configuration tool for Rational Integration Tester, helps you manage these supported technologies.

To configure libraries that are required to conduct a test, open Library Manager and from the Database (JDBC) tab:

  1. Select IBM DB2 9.7 from the Providers section.
  2. Browse to the Installation Directory, as shown in Figure 1:
Figure 1. Configure Library Manager for IBM DB2
To configure Library Manager, select IBM DB2 9.7

This demonstration uses sample WSDL for adding numbers, which does not require any specific Library Manager settings.

After you have configured the required libraries, you are ready to work on a Rational Integration Tester project.

Create a new project

A project is like a user workbench where you can create tests and stubs and execute them. Creating a project has three steps:

  1. Setting up a name and location
  2. Connecting to the project database
  3. Setting up a user-based permission

Steps 2 and 3 are optional, although step 2 is recommended because you can record and view test results. Here I've created a project with database MySQl – projectdb (assuming that the project database projectdb is created using MySQL).

From the Rational Integration Tester Welcome page, click New Project – Set name and location and navigate with the Next button until you reach the Server Settings screen of the Create New Project wizard. Choose these server settings:

  • Database provider: MySQL
  • Database URL: jdbc:mysql://localhost:3306/projectdb
  • Username: root
  • Password: your database password

When these steps are completed, click Finish, as shown in Figure 3:

Figure 2. Create New Project details
Create New Project and choose server settings

After you create your project, you can create your test environment using the workbench. Note the Perspectives toolbar, which has six perspectives. See Figure 3:

Figure 3. Workbench layout
Workbench layout shows perspectives toolbar

Figure 4 shows the six perspectives with a description of each:

Figure 4. Six perspectives
The six perspectives with a description of each

Create the test environment

A test environment is a set of runtime configuration settings that tests resources. To create the test environment, select Project from the Rational Integration Tester workbench and click Create New Environment. Figure 5 shows the Create New Environment wizard. Specify the name for the environment — for this example, use demo— and click OK.

Figure 5. The Create New Environment wizard
Creating a new test environment

Build the model system for testing

To build the model system for testing, you first want to add new Web Services Description Language (WSDL). For this demonstration, I'm using sample WSDL add numbers. Assume the service is started at location http://localhost:8088/addNumbers?wsdl. To invoke the new WSDL wizard, follow these steps:

Right-click in the logical view to New > Web > WSDL > Wizard. See Figure 6:

Figure 6. Invoke the add new WSDL wizard
To build model system for testing, add new WSDL

The wizard to add new WSDL appears. Click New. See Figure 7:

Figure 7. Configure the WSDL dialog
Configure the wizard to create new WSDL

On the New WSDL wizard, click Change. See Figure 8:

Figure 8. Browse to new WSDL location dialog
New WSDL location dialog provides Change button

In the Select Location wizard, click the URL tab. In the URL field, type: http://localhost:8088/addNumbers?wsdl. Click OK. See Figure 9:

Figure 9. The Select WSDL location dialog
Select Location dialog shows URL field

Now the addNumbers WSDL is added in the wizard. Click Next. See Figure 10:

Figure 10. Configured WSDL dialog
Configured WSDL dialog includes addNumbers WSDL

Now you can either create a new service component or select an existing component. For this demonstration, you want to create a new component, so proceed with the default choice Create a new Component. Click Next. See Figure 11:

Figure 11. Create a new Component dialog
Choosing a new or existing service component

The next wizard asks you if you want to create a new environment or choose an existing one. As Figure 12 shows, you've already created the environment for the project and named it demo. Continue by clicking Next:

Figure 12. Configure with the Environment dialog
Configuring the required Environment

Figure 13 shows the next set of options. Select Open Synchronization View and perform the synchronization. Click Finish to complete the WSDL synchronization.

Figure 13. The Synchronization options dialog
Finish with the Synchronization Options dialog

Click the Schema Library tab. Figure 14 shows the WSDL schema:

Figure 14. Schema Library
Schema Library dialog shows the WSDL schema

Click to see larger image

Figure 14. Schema Library

Schema Library dialog shows the WSDL schema

The WSDL is synchronized. Click on the Logical View tab to see it updated with the system modeled, as Figure 15 shows:

Figure 15. System modeled view
Logical View tab shows modeled system

Create the new test

You can create tests in the Test Factory perspective. Switch to the Test Factory perspective. Then:

  1. Invoke Test using the message exchange pattern (MEP) window.
  2. Right-click on the addition operation and select New > Tests > Test using MEP.

Send Request and Receive Reply actions are added to the test. See Figure 16:

Figure 16. Edit the Send Request
Edit Send Request screen

You can modify Send Request and Receive Reply actions with tags, or variables. Tags provide runtime configuration settings to test resources and are used to pass information within Rational Integration Tester.

The current test is modified for input values. See Figure 17:

Figure 17. Edit Receive Reply
Edit the Receive Reply screen

Save and execute the test

Now you're ready to save the test you created. To do so:

  1. Right-click the test to get the menu options.
  2. Select Run.
  3. Check to see if the test passes.

When the test passes, you'll see the Execution Result dialog displayed, as shown in Figure 18:

Figure 18. Execution Result for test
Execution Result when the test passes

Click to see larger image

Figure 18. Execution Result for test

Execution Result when the test passes

Create stubs for the service

Stubs simulate services that are unavailable. One way to create a stub is by using the MEP window. First select the operation for which you want the stub in the Test Factory perspective — in this case, the addition operation. Right-click addition, then select New > Stubs > Stub using MEP.

The definition of the MEP for the addition operation is based on the information in the WSDL file. The stub details are shown in Figure 19:

Figure 19. Edit the stub
Stub details for the addition operation

Click to see larger image

Figure 19. Edit the stub

Stub details for the addition operation

Rational Integration Tester provides elements to tests and stubs such as decision points, loops, and calls to other tests or external processes — even SQL calls to databases. All these elements can be added through the GUI without any coding required.

Save and execute the stub

To make sure the stub has replaced the service, stop addition service if it's running. You can make sure it has stopped by executing the addition test you created. The test fails if the service isn't running, as shown in Figure 20:

Figure 20. Execution test with failed results
Test execution result screen with failed results

Click to see larger image

Figure 20. Execution test with failed results

Test execution result screen with failed results

Now execute the stub:

  1. Right-click on the stub you created to see the menu options.
  2. Select Run.
  3. Check that the status of the stub in right panel is Ready.
  4. Execute the addition test again.

The test should pass this time, as shown in the Figure 21:

Figure 21. Execution test with passed results
Test execution result screen with passed results

Click to see larger image

Figure 21. Execution test with passed results

Test execution result screen with passed results

If the stub must be reused by other team members, it can be published to the IBM® Rational® Test Control Panel using IBM® Rational® Test Virtualization Server.


Conclusion

Building and maintaining service stubs is easy with Rational Integration Tester, because it doesn't require any coding skills and ensures maximum reuse. Rational Integration Tester helps in three key ways:

  1. You can continue testing when services aren't available.
  2. You can test earlier and more often, reducing the cost of defects.
  3. You can force behaviour in the system under test by controlling the services (or, more specifically, the responses from those services).

Resources

Learn

Get products and technologies

  • Download Rational Test Workbench, which includes Rational Integration Tester, from Passport Advantage. Registration and sales representative assistance required for access to 30-day free trial.
  • Download a free trial version of Rational software.
  • Evaluate other IBM software in the way that suits best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


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. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

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.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

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

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=953568
ArticleTitle=Stubs made easier with Rational Integration Tester
publish-date=11192013