Académique Documents
Professionnel Documents
Culture Documents
Integration Tester
Training Guide
Note
Before using this information and the product it supports, read the information in Notices
on page 132.
Copyright IBM Corporation 2001, 2012.
INTRODUCTION ........................................................................................................................ 4
2.1
PRE-REQUISITES............................................................................................................... 5
2.2
2.3
CONFIGURING THE LIBRARY MANAGER FOR WEBSPHERE APPLICATION SERVER AND MQ ...... 6
2.4
3.2
3.3
3.4
3.5
4.2
4.3
4.4
4.5
4.6
4.7
ENVIRONMENTS .............................................................................................................. 22
4.8
4.9
4.10
5
5.2
5.3
OVERVIEW ..................................................................................................................... 30
6.2
6.3
6.4
RECORDING MQ MESSAGES............................................................................................ 31
6.5
6.6
Page 1 of 133 IBM Corporation 2001, 2012
OVERVIEW ..................................................................................................................... 38
7.2
7.3
7.4
8.2
8.3
8.4
8.5
8.6
9.2
9.3
9.4
9.5
9.6
9.7
9.8
10
10.1
10.2
10.3
10.4
11
11.1
11.2
11.3
12
12.1
12.2
12.3
Page 2 of 133 IBM Corporation 2001, 2012
12.4
13
13.1
13.2
13.3
USING TAGS................................................................................................................ 91
13.4
13.5
DATA SOURCES........................................................................................................... 92
13.6
14
14.1
OVERVIEW .................................................................................................................. 97
14.2
15
15.1
15.2
15.3
15.4
15.5
15.6
16
16.1
16.2
16.3
17
17.1
17.2
17.3
17.4
18
18.1
18.2
19
19.1
20
Page 3 of 133 IBM Corporation 2001, 2012
1 Introduction
This document serves as a training manual to help familiarize the user with the functionality
present in IBM Rational Integration Tester. Most of the training exercises make use of a variety
of technologies, including IBM WebSphere Application Server, IBM WebSphere MQ, IBM DB2,
and web services. It is assumed that the reader has a fair understanding of these systems.
The main objectives of this training course are to present the various functionalities of Rational
Integration Tester and how best to use them in testing Message Oriented Middleware applications.
In this course we will:
Before we dive into this training course, please make sure you have all the correct files in place.
If you are using a cloud instance, the training files should be located on the desktop
Otherwise, your instructor will let you know where to find any required files.
Page 4 of 133 IBM Corporation 2001, 2012
Rational Integration Tester project database note that this can be shared between multiple
people. The database can be set up using one of the following:
o MySQL 5.0.1 or higher and MySQL 5.1.x
o Oracle 9.2i, 10g, or 11g
o MS SQL Server 2005
Java 7
o The IBM JRE is included and installed with the Rational Integration Tester. The JRE is
installed in the Rational Integration Tester installation directory and is used only
when Rational Integration Tester is executed. The JRE does not affect the registry or
any other programs on the system.
Any changes made in the Library Manager will not take effect until the next time you start Rational
Integration Tester. This means that if you are running Rational Integration Tester while making
changes in the Library Manager, you will need to restart Rational Integration Tester.
We will now look at an example use of the Library Manager setting up connections to Java
libraries for the IBM WebSphere Application Server and WebSphere MQ tools.
2.3 Configuring the Library Manager for WebSphere Application Server and MQ
Depending on the version of WebSphere Application Server and MQ, specific product libraries are
required. Please make sure that you have configured Library Manager with the right libraries. This
has already been set up for any cloud instances.
1. In the Library Manager, click on the IBM WebSphere Application Server item on the left
hand side. You will now see a list of providers, for each supported version of the Websphere
Application Server.
2. In the Providers section on the right hand side, select version 8.0 of WebSphere Application
Server.
3. Go down to the Settings section, and make sure that each of the necessary .jars has been
found. If not, select each one in turn, pressing the Edit button to locate the .jars. If necessary,
your instructor will be able to provide you with a copy of each file.
4. Next, you will need to do the same for IBM WebSphere MQ 7.0.
Page 6 of 133 IBM Corporation 2001, 2012
Page 7 of 133 IBM Corporation 2001, 2012
If you are running Rational Integration Tester on your local machine, you will need to make sure
you have a license at this stage cloud instances should already have a license installed for you. For
more information on licensing, please ask your trainer, or view section 2.2 of the rit_ins.pdf
installation guide.
Once licensing is sorted out, you have several options. From top to bottom:
Fetch Project from Source Control Check out a project from a source control system, and
open it. Note that you will need to configure Rational Integration Tester to communicate
with your source control system before doing this. See the rit_scm_ref.pdf plugin guide for
more information.
Page 8 of 133 IBM Corporation 2001, 2012
Open Link follows a link taken from the Test Lab to navigate to the results of a test or test
suite.
Open an existing project opens an existing project, either from the list of recent projects
shown by Rational Integration Tester, or by browsing to a .ghp file.
At the end of the wizard, a new project folder will be created within your file system. This folder
will hold all resources a model of the system under test, along with any tests, stubs or other
resources created for the project. Data files used by your project can also be stored here this can
help you make your project more portable by including everything in one place. Alternatively, you
might want to include those data files in another location Rational Integration Tester will be able
to refer to them either way.
3. We can now give our project a name, using the Project Name field. Well call our project
WWTravelTesting.
Page 10 of 133 IBM Corporation 2001, 2012
4. If desired, modify the Owner and Comments fields (these are saved with the project and
can be modified later).
5. In the Directory field, enter the full path to the directory where the project should be
created, or click Browse to locate the directory. The selected directory cannot contain an
existing Rational Integration Tester project.
6. When you are satisfied with the project details, click Next. If the selected directory does not
exist, you will be prompted to let Rational Integration Tester create it, or you can go back
and select a different directory.
7. The wizard will now display the Server Settings dialog. At the top of this dialog, there is a
Results Database section, where we can provide connection details for the project
database, which is used to store all of the test data collected by Rational Integration Tester.
A valid database and working connection are required to store or view any historical results
in Rational Integration Tester.
8. Rational Integration Tester will remember the database details that were used previously; if
you are using a cloud instance, this means that you should already have details entered for
you. Otherwise, you will need to enter the Database URL, User Name, and Password. If you
need to reenter them, the settings for the databases on the cloud instances are shown
below. Otherwise, ask your trainer.
Page 11 of 133 IBM Corporation 2001, 2012
Settings
Value
Database URL
jdbc:mysql://localhost:3306/projectdb
User Name
root
Password
root
9. Click on Test Connection. A window should pop up stating that the connection was
successful.
10. Below the database settings, we can connect to the Results Server and RTCP. We will not be
using the Results Server, but RTCP may be needed later on. The default setting here should
be sufficient:
Settings
Value
RTCP URL
http://localhost:7819/RTCP
Domain
BookingSystem
Page 12 of 133 IBM Corporation 2001, 2012
11. When you are satisfied with the details entered on this screen, click Finish. If userbased
permissions or connections to change management tools were required, you would need to
choose Next, and then set them up on the following screens.
12. The new project will be opened in Rational Integration Tester. By default, it will display the
Logical View in the Architecture School perspective.
Page 13 of 133 IBM Corporation 2001, 2012
The main window of Rational Integration Tester is a workbench that contains several dockable
windows. These windows are organized in a logical way, providing an intuitive, easytouse central
workspace.
Information about your current project can be found in the title bar and status bar. At the top of the
screen, the title bar indicates the name of the current project, along with the current environment.
At the bottom of the screen, the status bar indicates the name of the current test cycle, the current
user, and the memory usage. For the purposes of this manual, we will not need to be concerned
with the information in the status bar, though you may find it useful to keep an eye on the title bar
to check which environment is currently active.
Page 14 of 133 IBM Corporation 2001, 2012
Icon
Description
defines the architecture of the system under test, including
service components as well as logical and physical resources
Architecture School
Requirements Library
Recording Studio
Test Factory
Test Lab
Results Gallery
The initial layout of the workbench for each perspective is predetermined, and it can be restored at
any time by selecting Window > Reset Current Perspective from the main menu. Many aspects of
the workspace can be customized. Each window can be resized within the workbench by clicking
and dragging on its borders; it can be closed via the button in the top right hand corner and can
be set to automatically hide when not in use with or to remain constantly visible with .
Page 15 of 133 IBM Corporation 2001, 2012
Logical View
Physical View
Synchronisation
Schema Library
Data Models
Rule Cache
For the moment, were going to look at an example of a simple system, which will make use of the
first two views, along with Environments, which are used to tie the Logical and Physical views
together. Well then move to the Schema Library to set up message formats.
This is only a simple example, but it serves to illustrate the problem: if were not careful, we could
create tests or stubs that will need to be rebuilt as we move from environment to environment, or
even worse, resources that are not portable at all. Fortunately, Rational Integration Tester provides
a solution to this, by partitioning the model of the system under test. In order to move our
resources across different environments, we will set up the infrastructure of our system in three
sections: Logical View, Physical View, and the Environment.
Page 16 of 133 IBM Corporation 2001, 2012
The Logical View provides us with an abstract view of the system under test, but does not tie us to
using any particular infrastructure. As an example, it will state that a database is required by our
system, but it will not state any more than that the database URL, connection details, and even the
type of database provider are not specified at this stage.
The Physical View then defines all of the implementation options so, for our example, we may
have 3 separate databases used across all different environments. All 3 databases would be listed in
the Physical View.
Finally, the Environment binds the logical and physical resources together. At any stage, Rational
Integration Tester can check which environment is being used, and if a reference is found to a
logical infrastructure element, it will use the environment to find the correct physical component.
So, to finish off our example, if we need to access a database within a test or a stub, Rational
Integration Tester will look up the environment to determine which of the 3 databases should be
accessed. If we then move to another environment, Rational Integration Tester will perform the
lookup again, and select the appropriate database.
Of course, this applies to any infrastructure not just databases, but also web servers, Email
servers, Java Message Service (JMS), or any proprietary technologies.
The first object well need to create is a Service Component. Service Components act as containers
for all other elements within the Logical View, and may contain other Service Components to build
up more complex structures.
In most cases, well want to define Operations within a Service Component. Operations define the
functionality of the system. We will be able to create resources based upon the information
provided within each operation.
Page 17 of 133 IBM Corporation 2001, 2012
In order to communicate with the operations available within the system, well also need a set of
Infrastructure Components. These are named components that can be bound to physical resources.
Remembering that Logical View does not contain any concrete details of these components, they
will serve to tell us that there is a JMS server, database, web server, etc., while the Physical View
and Environment will provide more exact information later on.
All of these elements service components, operations, and infrastructure components may be
created by pressing Ctrl+N to create a new component, right clicking and using the context menu,
or from the toolbar at the top of the Logical View. In addition, you can use Ctrl+F to find resources
after they have been created.
Finally, we will use Dependencies to link operations to each other, or to infrastructure components.
Outgoing dependencies are displayed in lavender, and incoming dependencies are displayed in
green. Dependencies are only displayed for items in the diagram that are selected. In the example
diagram above, this lets us know that:
Operation1 has a dependency on Operation2, meaning that Operation1 may call upon
Operation2 (though it might not do so in all circumstances).
Operation2 has a dependency on the HTTPConnection. This will normally mean that either
we require this HTTP connection to act as the transport for the operation, or that the
operation may need to make use of the HTTP connection itself after it has received a
message.
To create a dependency, we can either draw it using the Add a Dependency button in the
toolbar, or if we are setting up an infrastructure component as the transport, we can do this by
opening up the operations properties by double clicking on it, and editing the transport
information within the Message Exchange Pattern tab of the properties window that appears.
Page 18 of 133 IBM Corporation 2001, 2012
The toolbar contains a number of other useful tools, at the right hand side:
Add a Dependency: allows you to draw a dependency between two operations, or from
an operation to an infrastructure component.
Edit Filters: filters determine which dependencies will be shown in the Logical View.
They may be necessary in larger, more complex systems.
Selection mode: puts the cursor into selection mode, where you can select and edit
elements of the model. This is the default cursor mode.
Zoom in: zooms into the diagram. This can also be done with Ctrl+MouseWheelUp.
Zoom out: zooms out of the diagram. This can also be done with
Ctrl+MouseWheelDown.
Zoom area: zooms to fit an area, drawn with the mouse, onto the screen.
Reset Zoom: sets the zoom back to the default level.
Fit to contents: zooms the screen to fit everything contained in the Logical View.
Pan mode: uses the cursor to pan around the screen.
Layout all nodes: automatically rearranges all elements contained in the Logical View, so
that nothing is obscured.
Grid: switches the grid on or off. The default setting is off.
We will now use the elements described above to start building a model of an example system. This
system will contain a single web service. We can use this same process to build a model of any
service oriented architecture. Later on, we will look at more efficient methods to build the model,
though as these are not available in all environments, well look at building everything by hand for
this first example.
Page 19 of 133 IBM Corporation 2001, 2012
2. Press the Start Service button. The Add Numbers Server window should update so that the
Start Service button is no longer valid:
3. Minimize this window (do not close it), and return to Rational Integration Tester.
4. From the Architecture School perspective, make sure that you are in Logical View using the
tab at the bottom of the screen.
5. The middle of the screen will be blank, as there is currently nothing in our model. To add the
first component of a system, right click and select New > General > Service Component.
When asked for a name, call it AddNumbers. It should then appear in your workspace:
6. Select AddNumbers by clicking on it. The outline should change to orange, to indicate the
selection.
7. Right click on the AddNumbers component, and select New > General > Operation. Call the
operation Addition. Your service component should now look like the following:
Page 20 of 133 IBM Corporation 2001, 2012
14. Try navigating around the logical view using the following controls:
o To navigate around the logical view you can use the horizontal and vertical
scrollbars, or press the Pan button and left click on the screen to drag it around.
o To adjust the zoom level you can use either the zoom buttons
Ctrl key and use the mouse wheel.
o To move any of the services or components around, ensure the Select Cursor button
is selected, and left click on the service or component you wish to move, and drag
it to the desired location.
o If you ever want to reset the layout of the services and components, then the Layout
All Nodes button will organize them into an efficient layout.
o To set the zoom level so that the entire diagram fits inside the screen, use the Fit to
Contents button .
Page 21 of 133 IBM Corporation 2001, 2012
2. Were going to add a new resource here. Along the top of the perspective, youll see a toolbar
containing options for adding new resources from different categories
3. Choose the Web category, and then choose the Web Server
option .
4. The New Web Server dialog will appear. Set the Host setting to localhost using Port 8088.
5. Press Test Transport to make sure that you are able to connect properly to the web service.
Once you are satisfied that it is working properly, press OK to close the dialog and save the
new resource.
4.7 Environments
Once we have the logical data, which gives us an abstract model of what infrastructure is required
by our system, and the physical data, which specifies the different configurations available for each
infrastructure component, we then need to match these up. Remembering that this could change
between different stages of the lifecycle of the project, we can use a set of environments to
coordinate this process.
A new project starts without an environment, so well create an initial environment in this exercise.
Other environments could be created subsequently as required. These will allow us to keep using
the same test resources, simply by switching to new environments as they become available.
Environments do not have their own view; instead, there are a number of options in the Project
menu which allow us to access and edit an environment: Create New Environment , Edit
Environments , and Switch to Environment . If you are using the default settings within
Rational Integration Tester, the Title Bar will also show the name of the current environment.
2. Give the environment a name for example, Local (most of the environment were working
with in this training course will be on the local host).
3. The Environments window will appear. On the left hand side, you can select the
environment to edit. On the right hand side, you can see how this environment is configured.
4. On the right hand side, you should be looking at the Properties tab, which will be empty at
the moment. The properties of an environment are expressed as tags, which will be covered
later in the course. For the moment, were not going to need to set up any properties
ourselves.
5. Switch to the Bindings tab. You should see the AddNumbersPort listed here. Note that the
physical connection for it is currently listed as UNBOUND.
6. Click on the UNBOUND setting, and a drop down box should appear, containing the option to
bind the AddNumbersPort to the HTTP Client at localhost. Select the new physical resource
to tell Rational Integration Tester that any messages sent to the AddNumbersPort will be sent
to localhost.
7. Press OK to save your changes and exit the dialog. You should see that the environment
name is now displayed in the Title Bar.
Once an environment has been created, we can also view and edit environmental data directly from
the Logical View. To do this, you can right click on an infrastructure component in Logical View,
and select either Physical Resource, which will show the related physical resource in the current
environment, or select Set Binding In..., which will allow you to set the binding in any
environment. This information can also be seen by opening the infrastructure component by
double clicking on it, and going to the Bindings tab.
Page 23 of 133 IBM Corporation 2001, 2012
2. At the top of the perspective, there is a toolbar containing buttons for importing different
types of message schemas.
The New WSDL window will appear.
button.
3. Press Change to enter the location of our schema definition. The Select Location dialog
box will appear.
4. Select the URL tab, and enter the following URL:
http://localhost:8088/addNumbers?wsdl note that the URL is casesensitive. Press
OK to close the Select Location dialog, and again to close the New WSDL dialog.
5. You can also view the schema information used by the addNumbers service by going to the
same URL with your web browser.
6. Once the schemas have been imported, you can then view them in Rational Integration
Tester. Select WSDLs on the far left of the screen. You will then be able to see the
addNumbers WSDL displayed on the left hand side. Select this WSDL; the details of the
schema should then be shown on the right hand side. The Source tab will give the same
schema information we saw in our web browser.
Page 24 of 133 IBM Corporation 2001, 2012
Note: If you have mistyped the name of the WSDL, you should receive a warning, and the
right hand side of the screen will not show the message schemas. If you end up in this
situation, you can fix it in the following manner:
Amend the location of the WSDL by using the Change button next to the WSDL Location at
the top of the screen. Following that, press the Rebuild button to rebuild the schema
data.
7. Go to the Config tab to view each individual message type. You can select each message type
using the Operation drop down just under the tabs along the top of the screen. Use this to
view the three message types: addition__INPUT__addition,
addition__OUTPUT__additionResponse, and addition__FAULT__AdditionException.
Page 25 of 133 IBM Corporation 2001, 2012
8. Press OK to close the Addition operation.
We now have all the information we might need to work with a very simple web service. For more
complex systems, it would be preferable to analyze the system to derive some or all of this
information automatically. We can do this in two ways, depending on the technologies involved
by synchronizing with the system, or by building a model of the system from recorded events.
Page 26 of 133 IBM Corporation 2001, 2012
Tomcat 7.0.26
IBM WebSphere MQ 7.
When a user makes a booking, Tomcat publishes a message onto a MQ queue, which is then
retrieved by the MakeBooking service running in WebSphere Application Server. This looks at the
credit card type, and posts a message onto a queue for that card type (Global, Multinational, or
Worldwide). A service for that card type, also running on WebSphere Application Server, will then
pick up the message, and process it. In order to process the booking, the service needs to know
what reservation numbers exist, create a new reservation number, and record it for future
reference. All of this is done by referring to a DB2 database which is used to hold booking
Page 27 of 133 IBM Corporation 2001, 2012
information. The reservation number is then passed back to MakeBooking, to Tomcat, and then the
user.
When a user wants to manage a booking, Tomcat will be interacting with a set of web services
implemented by WebSphere Application Server. These services will allow the user to log into the
booking system, search existing bookings, update bookings, or delete them. Searching, updating,
and deleting will access the same database that was used previously for making bookings.
Page 28 of 133 IBM Corporation 2001, 2012
Page 29 of 133 IBM Corporation 2001, 2012
WSDL
SAP System
Adding any of these to your project will give you the option to synchronise with the data held by
that external resource. To start the synchronisation process, you can add any one of these
infrastructure components to the Logical View of Architecture School, or by switching to
Synchronisation view and adding it there. Either way, the process of adding a synchronization
source will provide the option of synchronising. Multiple synchronisation sources may be added to
the project if required.
Postsynchronisation, the system under test may change; as this will be recorded within the
synchronisation source, it is possible for Rational Integration Tester to update the project to reflect
these changes. To do this within the Synchronisation view, first press Check Synchronisation
this will compare the system model within the Rational Integration Tester project against any
synchronisation sources, and display any differences between these. Following on from that, you
Page 30 of 133 IBM Corporation 2001, 2012
can press the Synchronise button, which will then update the Rational Integration Tester
project to resolve these differences.
Queue Browsing
Proxy Queues
Mirror Queues
Queue Aliasing
Your choice will depend on several factors. Some methods, such as the use of proxy queues, require
changes to the system under test. Others are invisible to the system under test, but require access
to the MQ server in order to make modifications. Other factors will include determining if the
system under can be stopped temporarily, to ensure that no messages are missed, and connections
can be set up appropriately; and finally, the amount of effort required on the part of the user, and
the impact on the performance of the MQ server. For more information on the pros and cons of each
method, please refer to the Recording Settings section of the document rit_wmq_ref.pdf. In our
example, we will be using dynamic mirror queues, as this requires no modification to the system
under test, and requires a very small amount of setup on the part of the user.
Regardless of the method that you have chosen, the recording setup should look quite similar to the
following:
Page 31 of 133 IBM Corporation 2001, 2012
The client application will communicate via request and reply queues with a given service. Rational
Integration Tester will read the request and response messages being posted to the queues within
the queue manager. While the queue manager may act slightly differently to its usual behavior for
example, by copying each message to a mirror queue the messages themselves will be untouched,
and the actions of the system under test should also be unchanged.
Note that we may choose to record just a given service, if we have an operation definition (and so
know which queues to monitor), or we may record all queues within the queue manager by
recording the MQ transport.
4. As were using an MQ server on the local machine, enter localhost as the host. The port
should be 1414.
5. We then need to set up the Channel and Queue Manager. Set the Channel to
wwtravelwebapp and the Queue Manager to QM_wwtravel. The settings for the transport
should be as follows:
6. Press Test Transport to make sure everything is set up correctly so far. After Rational
Integration Tester has reported that it has successfully connected to the MQ server, which
may take a moment, switch to the Recording tab.
Page 33 of 133 IBM Corporation 2001, 2012
7. Under Queue Recording, set the Recording Mode to Dynamic Mirror Queues. All other
settings here can be left at their defaults.
8. Finally, switch to the Advanced tab. Here, set the number of QM Connections to 5. This will
allow us to manage more connections with the queue manager, in case we may be working
on multiple tasks at the same time (e.g., recording and stubbing).
Page 34 of 133 IBM Corporation 2001, 2012
9. Press OK to close the properties for the MQ Queue Manager.
10. As our services will be running on the Websphere Application Server, well want to model
that, too. Also within the WWTravel service component, add a New > IBM > IBM Websphere
Application Server, and call it WWTravel_WAS.
11. As with the MQ Queue Manager, right click on WWTravel_WAS, and select Set Binding In >
Local > Create New IBM WebSphere Application Server.
12. Enter localhost as the Hostname, and 2809 for the Bootstrap Port. Press OK to close the
properties of the WebSphere Application Server.
Page 35 of 133 IBM Corporation 2001, 2012
13. Finally, well add the booking database that will be used by several of the services in our
system. Again within the WWTravel service component, right click and select New > General
> Database Server. Call it WWTravel_DB.
14. Again, right click on the database, and select Set Binding In > Local > Create New
Database.
15. We can now enter the physical properties for our database. First, well need to select the
Driver in this case, were using a DB2 database, so select the IBMDB2(Universal) driver.
16. As for the other settings, the Maximum Number of Connections should be set to 1, the
Database URL should be jdbc:db2://localhost:50001/WWTRAVEL, the User Name
traveluser, and the Password PiEvG7, as seen below:
17. Press Test Connection to make sure that the database connection is up and running, then
press OK to close the dialog box.
18. Your Logical View should now show the WWTravel service component like so (in addition to
the AddNumbers service component created earlier):
19. Finally, open up the Environment Editor using Project > Edit Environments, and verify
that all of the logical and physical components have been bound correctly:
Page 36 of 133 IBM Corporation 2001, 2012
We have now modeled the basic infrastructure of the Worldwide Travel system. From this point,
we could move directly to recording events from the system, and modeling the operations from
that. Well make this a bit easier by importing some message schemas before we begin recording.
4. You can select each of these, and view the associated message schemas on the right hand
side of the screen.
Page 37 of 133 IBM Corporation 2001, 2012
7 Requirements Library
7.1 Overview
In the Requirements Library perspective, the user defines the requirements for an interface in the
form of messages. Messages can be created from scratch or captured and saved from Recording
Studio. There are several advantages of having these message requirements:
They facilitate the creation of tests by dragging and dropping these messages onto a
messaging action type in the Test Steps.
It helps keep tests consistent across multiple users as each can share this repository of
defined message structures for various components under test and in essence acts as a
message catalogue
It provides an example of how the data should look like for a particular test. A user may
decide to use a message captured by someone else with the knowledge that the data has
been captured and therefore is correct. Examples of use are for creating triggers and stubs.
It is fairly common during development or testing of EAI or SOA projects that components are
unavailable. We will look at creating stubs for such components later in this document.
For the moment, were going to look at how Rational Integration Tester processes different
message formats, using the Requirements Library.
Page 38 of 133 IBM Corporation 2001, 2012
Depending on the context, the message editor will have a number of tabs. We will look at these in
more detail as we come to use them, but the main tabs you will see are:
Config: Provides main configuration information, including information about the transport.
Also reflects the settings used in the Value or Assert tab.
Value/Assert : Provides values to send for each field, or expected values for those fields if
receiving a message.
5. The right hand side will now be partly populated. You should see a simple tree structure for
your new message, with a Text(Message) above a text(String). Right click on the text
(String), and choose to paste the XML data we copied earlier. You should end up with a
message that looks like the following:
6. If an error occurs, go back to the XML document in notepad, and make sure that you have
copied all of the XML before attempting to paste it into Rational Integration Tester again.
7. Compare the original XML document with the tree structure generated in Rational
Integration Tester, then Save this message.
Page 39 of 133 IBM Corporation 2001, 2012
6. Press Next you will now see a set of options that will sometimes be useful when applying
schemas to a message. In particular, there will be circumstances where the option to Include
optional fields will be needed. For this message schema, however, there are no optional
fields, so we can simply press Finish.
Page 40 of 133 IBM Corporation 2001, 2012
7. You should now see the message formatted using the input message schema for the
addNumbers service. We can edit this further, as required. For example, you may want to
delete certain nodes from a particular message well delete the second argument for the
addition. To do this, select the arg1(Element) node, and press the Delete key. Rational
Integration Tester will ask for confirmation answer Yes to this.
8. The message structure will be updated, and you will see orange and red x symbols to inform
you that there is an error somewhere in the message. You can hover your mouse over these
symbols to get more information, but in general, an orange x symbol indicates that there is
an error somewhere further down that branch of the tree, while a red x symbol indicates
that there is an error inside that specific node. Hover over the red x you should see that the
schema indicates that the addition element should have an arg1 element inside it.
9. To add the element back to the schema, right click on the tns:addition(Element) node,
and select Add Child > arg1 (Element). The message will be updated, and as the message
now conforms to the schema, the error markers will disappear.
10. As weve still got null values for each of the arguments, edit the Textnodes for arg0 and
arg1, and enter a number for each one.
11. Save the message.
Page 41 of 133 IBM Corporation 2001, 2012
We have now seen how to import example messages by copying and pasting the data into Rational
Integration Tester. We have also created an example message by applying a message schema and
entering the data manually.
As we will see in the next section, is it also possible to record messages from the live system, and
save them as requirements for later use.
Page 42 of 133 IBM Corporation 2001, 2012
8 Recording Events
8.1 The Recording Studio
Rational Integration Tester and the agents provide us with the capability to record events
(messages or database interactions) from the system under test. The Recording Studio allows us to
control what parts of the system we wish to record, whether it might be specific parts of the system
infrastructure, or specific services using that infrastructure. We do this by setting up Event Monitors
that specify what we wish to record.
Once we have decided what to record, we can then begin recording. As events are recorded, they
are displayed within the Events View. If desired, Event Monitors can be added or removed as we
record. We can also filter what events are shown in the Events View by selecting different monitors
within the Event Monitors panel. As events of interest are recorded, we can view more details for
these events by selecting them within the Events View further details will then appear in the
Event Details panel below.
It is important to note that recording these events does not interfere with the operation of the
system under test. Events will still be dealt with in the same way that they usually would be the
only difference is that those events will be accessible through Rational Integration Tester.
Page 43 of 133 IBM Corporation 2001, 2012
Following recording, events may be reused in a variety of ways. The simplest thing we can do is
export the recorded events to disk, so that they may be imported back into the Recording Studio at
another point in time. Otherwise, events can be used to build:
Operations
Triggers
Requirements
Data Sets
Tests
Stubs
If we do not have a complete model of the system under test, then events recorded from the
transports within the system may be used as a basis for building new operations within our system
model.
Events may be reused in the form of Triggers; a trigger allows us to stimulate the system under
test directly from Rational Integration Tester. We can then record what happens in response note
that this will not necessarily be the same as what happened when we originally created the trigger,
and we will not be performing any validation on any events recorded in response to the trigger.
This means that we can send events to the system without going through the GUI layer (or any
other layer of the system that we might prefer to bypass), allowing us to understand how the
system reacts to various inputs.
In other cases, we may wish to save a message for later on, without specifying how it will be used. It
may be saved in the form of a Requirement, giving us an example message that we can view in the
Requirements Library. Those requirements may later be imported into other resources.
We can also use recorded groups of events to create tests or stubs. The data within the events may
be hardcoded into the test or stub; it may also be entered into a data set such as a CSV file, or a
data model, which maps the relationships between the data in the system.
Page 44 of 133 IBM Corporation 2001, 2012
5. Right click on the WWTravel_MQ component, and select Record. The perspective will change
to the Recording Studio, and the WWTravel_MQ transport should be listed in the Event
Monitors.
6. Click the Start Recording button in the Events View toolbar to start recording events.
7. In a browser window, open the Worldwide Travel booking site. For a cloud image, this will
be listed in the favorites menu of your web browser; otherwise, ask your trainer.
8. Click on the Stansted to Barcelona Book Now button. Here, you will have the opportunity
to book a flight and a hotel. For the moment, well only worry about flights, so skip the hotel
data at the top of the form, and just enter passenger and payment details for a flight. Make
sure that you select Multinational as the credit card the other details do not matter, as
long as they are filled in.
9. Click Proceed when finished and you should see a confirmation page with a reservation
number.
Page 45 of 133 IBM Corporation 2001, 2012
10. Return to Rational Integration Tester and you should see that 4 events have been recorded
in the Events View.
11. Click on the first message in the Events View. You should then see the message details
appear in the panel below, showing the message that was initially sent by Tomcat.
12. We still need information on how the system deals with requests for other credit card types,
as these will be posted to different queues, so return to your web browser, and make
bookings for Global and Worldwide credit cards. These should also be recorded in Rational
Integration Tester, giving you a total of 12 recorded events.
Page 46 of 133 IBM Corporation 2001, 2012
4. The Recorded Events wizard will appear, allowing us to choose what we will do with the
selected events. To build a model of the system under test, we need to create some
operations, so select that option, and then press Next.
5. Rational Integration Tester will now display the 12 recorded messages, attempting to
separate them into distinct operations. It should look something like the following:
Page 47 of 133 IBM Corporation 2001, 2012
6. As the operation names are generated from the queue names used, we might like to change
them to something more useful. Select the first message belonging to the operation that is
currently named wwtravel.bookingwwtravel.booking.reply.
7. You will now be able to enter a new name below, so enter MakeBooking, and press Rename.
You will be asked if you want to apply this change to all other messages that were associated
with the same operation answer Yes. You should then see the Operation column update
accordingly.
Page 48 of 133 IBM Corporation 2001, 2012
8. Next, we will add the message schemas for MakeBooking. To do this, select one of the request
messages for MakeBooking on the left hand side of the dialog (it will contain all of the data
you entered into the web form earlier). On the right hand side, select the second line of the
message, beginning text(String).
9. The Add Schema button should now be active. Press it, and the Select Schema dialog will
appear. On the left hand side, select XSDs, then the BookFlightRequest XSD. Press Finish to
apply the schema to this message. You should then see the namespace update within all
fields of the message:
Page 49 of 133 IBM Corporation 2001, 2012
10. Now select a response message for MakeBooking, and follow the same procedure, using the
BookFlightResponse XSD.
11. Well need to go through the same process for the other operations in our system. Select the
two messages that are associated with the wwtravel.payment.multinational queue, give
them an operation name of ProcessMultinational, and press Rename.
12. We also need to set up message schemas for ProcessMultinational, but this will be a little
bit simpler than for MakeBooking. If you take a look at the response message, youll see that
it only includes a single text field, so we wont need to apply a schema there. Select the
request message for the ProcessMultinational operation, and apply the Payment XSD as
the schema.
13. You can set up the last two operations for Global and Worldwide cards in exactly the same
way call them ProcessGlobal and ProcessWorldwide; you can use the same message
schemas as for ProcessMultinational. Once youre done, the dialog should look like the
following:
14. Press Next. You will then be able to select where in the model of the system these operations
should be created. By default, WWTravel should be listed as the parent service component for
all of the operations were creating, as it is the parent service component for the
infrastructure we recorded earlier. As this is suitable, press Next.
Page 50 of 133 IBM Corporation 2001, 2012
15. Youll now see a summary, letting you know that Rational Integration Tester will be creating
4 operations for you. Make sure that Open resource after finish is unchecked, then press
Finish to create all 4 operations. You can now switch back to the Architecture School to see
what has been created.
16. In the Logical View, you can now double click on each operation to view its properties. Do
this for one of the operations you created, and view the Message Exchange Pattern tab.
This should show you the message schemas you set earlier for request and reply messages;
Page 51 of 133 IBM Corporation 2001, 2012
it should also show you the transport information used by that operation, including the
names of the queues that it uses.
Page 52 of 133 IBM Corporation 2001, 2012
4. You will now be given the option to choose to record any of the dependencies of the
MakeBooking operation at the same time. You should see that the WWTravel_MQ transport is
available, as are the other three operations. This is because the default behaviour is to show
only items that MakeBooking has a direct dependency on (the WWTravel_WAS component is
not shown, as Rational Integration Tester cannot record directly from the WebSphere
Application Server). Switch the radio button at the top of the dialog from Direct Only to
Indirect Only, and you should see the WWTravel_DB component become available, while the
other dependencies are hidden; MakeBooking only has a dependency on WWTravel_DB
through the other operations in the project, rather than having a direct connection to it.
Finally, switch to Both, and you should see all recordable components that MakeBooking has
a dependency upon.
5. Select the ProcessMultinational, ProcessGlobal, and ProcessWorldwide operations. Note
that if there were other operations had dependencies on the MakeBooking operation, we
Page 53 of 133 IBM Corporation 2001, 2012
could select those on the Parent References tab; as nothing depends on MakeBooking in our
system, this will not be necessary. Press OK to continue.
6. All 4 operations created in the previous exercise should now be listed in the Event Monitors
panel. If any of them are not listed, return to step 2, and add any missing operations.
7. Press the Start Recording button.
8. Switch to your web browser and submit another booking request, using a Multinational
credit card.
9. Return to Rational Integration Tester, where you should see 4 events recorded in the Events
View 2 each for MakeBooking and ProcessMultinational.
10. You can filter recorded events to show only those events that were recorded for a given
event monitor by selecting the event monitor in the Event Monitors panel. For example,
click on the MakeBooking event monitor. You should now see just the MakeBooking events,
with the events recorded for ProcessMultinational filtered out.
11. Click in the empty space below the list of event monitors to clear the filter you should see
all 4 events again.
12. Record 2 new bookings, again using the Global and Worldwide options. You should now
have 12 messages in total.
Page 54 of 133 IBM Corporation 2001, 2012
13. Again, youll be able to filter by source. Note that you can select multiple event monitors at
the same time when filtering, to show messages from multiple operations.
14. We will save two of these example messages as requirements. With the first message for
MakeBooking selected, click on the click on the Save icon on the Events View toolbar to
open the Recorded Events Wizard.
15. Select the requirements option on the first screen, and press Next.
16. On the second screen, you will be asked how the data within the message should be stored.
You choose either hardcoded values, or to use a data source. Well look at using data sources
later in the course, so for now, choose to Store data as hard coded values, and press Next.
17. Following this, Rational Integration Tester will confirm that the requirement is associated
with the correct operation. As we have recorded from an operation, this should state
MakeBooking as the operation. This is correct, so press Next again.
18. On the Summary screen that appears, you will be asked to give the requirement a name. Call
it exampleRequest. Uncheck the box labeled Open Resource After Finish, and press Finish
to create the new requirement.
19. Do the same for the corresponding reply message, calling it exampleReply.
20. You can now switch to the Requirements Library to view the saved messages.
So far, we have just stored a single message for later reuse. Later exercises will look at other ways
we can reuse the messages that we have saved.
Page 55 of 133 IBM Corporation 2001, 2012
5. Doubleclick the TriggerMakeBooking trigger to edit it.
6. The Edit Trigger dialog is displayed. Select the Value tab and update one of the fields (e.g.
change the passengerFirstName field) in the body.
Page 56 of 133 IBM Corporation 2001, 2012
7. Click OK to save the change and close the dialog.
8. Click Record in the Monitor View if it has been stopped.
9. Run the trigger by right clicking it in the Triggers view, and selecting Run Trigger from the
context menu.
10. A new series of events will be recorded in the Monitor View.
11. To verify that the request contains the updated field, select the event and view the updated
field in the message view below.
12. Stop the recording using the button. Do not clear the recorded messages as they will be
used in the following exercises.
Page 57 of 133 IBM Corporation 2001, 2012
Creating a test from recorded events can be done from the Recording Studio perspective; all other
options are handled in the Test Factory.
Well create our first test from recorded events. Well then take a closer look at how that test is put
together, and how we can edit it. Finally, well look at other methods of creating tests using the
MEP, and using templates.
The Business View provides a usereditable view. By default, it is exactly the same as the Technical
View, but it may be edited by the user to add a description of the action. In the example below, the
two messaging actions have been edited to add a description; the rest of the test has been left alone:
Switching between Technical View and Business View can be done by using the Technical View
and Business View buttons on the main toolbar at the top of the Rational Integration Tester
window.
Once you are looking at the Business View, action descriptions can be edited in a couple of ways:
Click once on the action to select it, then once again to edit the description.
Page 59 of 133 IBM Corporation 2001, 2012
4. The next screen provides a choice of how to store the data used in the test. For this example,
take the option of hard coded values, and press Next.
5. The wizard will then allow you to verify that the correct operation has been used in our
case, we should just see messages from MakeBooking. If this is not the case, youll need to
restart the wizard, making sure that you have only selected a request/reply pair for
MakeBooking. Otherwise, press Next again.
Page 60 of 133 IBM Corporation 2001, 2012
6. The following page checks that all requests and replies are matched up correctly in this
case, there is only a single request and reply, and these are already matched up for you.
Press Next to continue through the wizard.
7. On the Summary page, you can give the test a name call it Regression1. For simplicity,
make sure that the Open resource after finish option is enabled to open the test in the Test
Factory after saving.
Page 61 of 133 IBM Corporation 2001, 2012
8. You are now in the Test Factory perspective. You should see a new test created in a folder
called Tests, contained in the MakeBooking operation. The panel to the right displays the
new test and the steps it contains.
9. Doubleclick on the Send Request step. You will see the message schema populated with the
details you entered in the booking form. Note also that the Transport, Formatter and
Service settings have been populated for you.
Page 62 of 133 IBM Corporation 2001, 2012
10. Close the Send Request step, and doubleclick on the Receive Reply step. Again, note that
the message has been prepopulated.
Page 63 of 133 IBM Corporation 2001, 2012
Note: When creating a test from recorded messages, Rational Integration Tester will use the
messages in the same order that they are listed in the Events View. This means that youll need to
select the request, then the response using recorded events listed in the wrong order will create a
test with the messages in the wrong order.
test actions will take their schema and transport information from the MEP. The main difference
between the two is that creating a single test using the MEP will create a Send Request step where
the fields within the message are all blank; creating multiple tests will fill in the input messages
with random or constant data, as selected within the wizard. In both cases, the Receive Reply action
will contain a message using the appropriate schema, but all fields will be blank, as Rational
Integration Tester does not know how the system is meant to respond to the first message. You can
either edit this test action, or leave it till later to repair in the Test Lab well make use of this
second option later.
Page 65 of 133 IBM Corporation 2001, 2012
3. Click Next, which brings you to the wizards second page. Here, you can control the contents
of the message by selecting different content types for each element and values for those
elements that do not have random content generated for them.
4. Notice that IterateEnum is selected for the Payment:cardType element. This will prompt
the wizard to generate a unique test for each type of credit card that the operation can
process (three in this case), which can be verified in the next page of the wizard.
5. Instead of allowing completely random strings for all fields, were going to edit some of
them. Set the flightNumber field to a constant, with a value of WW100.
6. For the price and weekNumber fields, well allow random values, but well set some
constraints. In both cases, wed like to have a 2 digit number. Set the Type for the field to
Random Regex, and the Value to \d\d
7. In the final screen of the wizard, go to the With Tests section, and select Do Nothing. Click
Finish to close the wizard and generate the tests.
Page 66 of 133 IBM Corporation 2001, 2012
8. Lets take a look at what this wizard did. In the Test Factory perspective, look at the Tests
virtual folder under the MakeBooking operation. The wizard created three new tests.
9. Doubleclick to open one of these: paymentcardType=multinational
10. Doubleclick to look inside the Send Request action.
11. Here you see the request message which will be sent for this test of the MakeBooking
operation. The wizard has created the message with the expected structure and populated
most fields automatically with randomised values. The flightNumber field should be set to
WW100, while the weekNumber and price fields should be set to random 2 digit numbers.
Similarly, the cardType field should be populated with one of the three possible card types
(a different one in each of the three generated tests)
Page 67 of 133 IBM Corporation 2001, 2012
12. Close this window without making changes.
13. Open the Receive Reply action. At this stage Rational Integration Tester doesnt know much
about the expected response from this request. This message structure has not been
populated yet.
14. Close this window.
Page 68 of 133 IBM Corporation 2001, 2012
(including transport settings) and the message body; using the two icons, we can choose what we
want to link, rather than linking everything in one go. From these icons, you can also choose to
change a link to use a different requirement, or to unlink the message. Unlinking a message means
that the message will then hold a copy of whatever was in the requirement at the time; future
updates will not flow through to the test action automatically. If desired, you can relink to the
requirement later on.
Page 69 of 133 IBM Corporation 2001, 2012
4. The template should now be populated with the same test actions as the Regression1 test.
Save and close the template.
5. Well now use the template to create a new test. Right click on the MakeBooking operation,
then select New > Tests > Test From Template.
6. Within the dialog that appears, select the basicTemplate, and give your new test a name,
such as exampleFromTemplate.
7. Open the new test, and take a look it should contain the same actions and data as the test
template. You can now edit this further; for example, you might change some of the data
within the Send Request action. Once youre finished, save and close the test.
Page 70 of 133 IBM Corporation 2001, 2012
10 Test Execution
10.1 The Test Lab
The Test Lab allows us to execute tests, test suites, and stubs, and view their execution status. All
available resources are show in the Test Execution Tree, and can be run by double clicking, by
right clicking and selecting Run, or by selecting the resource, and using the Run button in the
main toolbar of Rational Integration Tester.
The Task Monitor will then show each execution of a test resource, showing a progress bar, and
the status (pass/fail) of the resource. Selecting a test execution in the Task Monitor will display
more information for that test execution in the Console. This will include a summary of what
happened during the test, along with any logging information.
results can be found in the Console, in the lower portion of the window. In this case, the test
should fail because the reservation number does not match what is expected.
3. Click on the Receive Reply error in red on the Console. The View Message Differences
window pops up to reveal the difference in the Expected and Received messages. In this
case the newReservationNumber elements are different.
1. The View Message Differences window gives us the opportunity to correct any
discrepancies between the expected and received messages. In this case, well try to update
the message by pressing the Overwrite expected field button.
2. Select the test and click Run in the Task Monitor to run the test again.
3. The test should fail again due to a reservation number mismatch. The reservation numbers
increment with each reservation, so attempting to use a hard coded value will not work.
4. Bring up the View Message Differences window for this new run of the test. Well try to
repair the test again, but this time, well use the Replace with regex match button to use a
regex that will allow any reservation number.
5. Open up the test in Test Factory perspective and doubleclick the Receive Reply step and
note that the value of the message field element newReservationNumber has been replaced
by a regular expression.
6. Rerun the test in the Test Lab.
7. This time the test passes.
Page 73 of 133 IBM Corporation 2001, 2012
8. Bring up the Message Differences window for this latest run of the Regression1 test. Note
that the regex is now displayed as part of the expected message, allowing the received
message to pass the test.
9. The tests generated using the MEP wizard will need to be handled differently, as they have
no data describing what the expected message is to look like. To start, run the
paymentcardType=global test. This will fail.
Page 74 of 133 IBM Corporation 2001, 2012
10. Bring up the Message Differences window. You will see that the expected message is
missing some of the fields found in the received message.
11. Therefore, instead of overwriting just a single field, choose Overwrite expected message.
12. If we run the test again, it will still fail. This time, it will be due to the reservation number not
matching, as in the Regression1 test. We could repair the field in the same way that we did
previously, but we would need to do the same thing for each of the other tests as well.
Instead, well use the Rule Cache to apply repairs to multiple tests.
10.4 Exercise: The Rule Cache
When validation errors are repaired and cached the repair method is saved as a validation rule.
These rules will be applied to the same field from which they are created when the same schema is
in use. Rules are managed under the Rule Cache view in Architecture School. Existing rules are
listed on the left side of the view, and they can be sorted by namespace or path by clicking on the
appropriate column heading. The star in the left column indicates whether or not the rule is
currently enabled or disabled .
1. Run the paymentcardType=global test again. As predicted, it should fail due to the
reservation number.
Page 75 of 133 IBM Corporation 2001, 2012
2. Bring up the Message Differences window, and check the box Add to Rule Cache
3. Make sure that the reservation number field is selected, and press the Replace with Regex
button
4. You will be asked to confirm that you want to apply this change as a rule.
5. After this, check that you are satisfied with the proposed regex, and carry out the changes as
normal. Before leaving the Message Differences window, you will notice that a star has
been placed next to both the expected and received fields.
6. Close the Message Differences window, and run the test again. It should now pass.
7. Switch to the Test Factory perspective, and open the paymentcardType=global test.
8. View the Receive Reply step of the test, making sure that you are looking at the Config tab
of the dialog. Here, we can see that the regular expression has been applied, as in the
previous exercise but in this case, there is a star next to the regular expression, letting us
know that a rule exists.
9. Return to the Test Lab and run the other two tests that we havent yet repaired. You will
find that they both fail at first, as the expected message is incorrect. This can be fixed as in
the previous exercise. Once you have done this, there will be no need to worry about the
reservation numbers any more the regular expression specified within the rule will be
applied for you automatically.
Page 76 of 133 IBM Corporation 2001, 2012
Page 77 of 133 IBM Corporation 2001, 2012
11. On the final page, you will be able to specify a name for the stub. Set this to
SimpleBookingStub, and make sure that Open resource after finish is checked.
12. Press Finish to create the stub. Rational Integration Tester should then switch to the Test
Factory perspective.
13. We can now take a look at the stub weve created. In the Transitions section, we have a list
of the events that the stub will respond to. The stub we have created only knows how to
respond to events for MakeBooking.
14. Below this, we can see the messages we recorded previously, in the Input and Output tabs.
15. By default, the stub will attempt to filter out anything that doesnt exactly match the default
message that we received. In those cases, it will not send a response message. For our
example, wed like to respond to anything that matches the same message structure; it may
or may not have the same values within the message fields. This will make our stub a bit
more versatile. To get started, switch to the Input tab, and take a look at the message body.
You will see that each field has a small filter icon next to it:
16. We want to switch off any filtering that is checking for an exact field match. The Does Exist
filters wont matter, as long as the basic message structure is the same. To switch off filtering
for the exact matches, select all of the fields within the message (you may need to scroll
down to do this). With everything selected, right click and choose Contents > Field Actions
> Filter > Equality. This will toggle the equality checks off, and the message body should
then appear with fewer filter icons, like so:
Page 78 of 133 IBM Corporation 2001, 2012
17. The remaining filters are simply checking that each part of the structure of the received
message is the same as what we see here. This is fine, as there is only one valid message
structure according to the schema. Switch to the Output tab, and take note of the
reservation number that will be sent by the stub. You should see this again in the following
exercise.
18. Save your stub its now ready to be executed.
Page 79 of 133 IBM Corporation 2001, 2012
5. Return to Rational Integration Tester, and switch to the Test Lab perspective.
6. Youll still see your stub in the tree on the left hand side of the screen. Run the stub, either by
double clicking on it, or by selecting it and pressing the Run button.
7. The stub will then appear in the Task Monitor. Some initial details will appear down below,
in the Console. This will be updated later on, as the stub receives incoming messages, and
responds to them.
8. As it stands, the stub will now wait until it receives some input, so lets provide something
for it to work with. You can either do this by making a new booking in your web browser, or
by running a test for the MakeBooking operation.
9. In the Test Lab of Rational Integration Tester, take a look at the console output for your
stub. You should now see that the stub has received a message, and sent a reply.
10. If you make another booking, you should see that you are receiving the same booking
number every time. As we turned off the filtering of messages within the stub, it shouldnt
make any difference what booking request we send to the stub; we just need to be using the
same message structure.
5. Switch to the Test Lab perspective.
6. You should see in the Task Monitor that the stub has automatically been stopped, and
started again:
7. Make another booking in your web browser it should now give you the new reservation
number you have entered.
8. As were now finished using this stub, well switch back to the live system. Within the Test
Lab of Rational Integration Tester, select the currently running version of the stub in the
Task Monitor (it will be the one with a Status of Ready).
9. The Stop button in the Task Monitor toolbar will now be available press it to stop the
stub.
10. Well now want to restart the booking service on WebSphere Application Server, so return
to your web browser, and go back to the console interface. If you closed the browser
previously, navigate back to the list of applications again.
11. Select the com.wwtravel.booking.app application by checking the box next to its name, and
Start it. All services should be running, as shown below:
Page 81 of 133 IBM Corporation 2001, 2012
12. If you make any further bookings, you should now notice that you are receiving new
reservation numbers again each time you make a request.
It would be possible to create a more complex stub which generated new reservation numbers for
each booking. This would require use of more complex actions within the stub. Note that this may
or may not be necessary, depending on what you intend to do with the stub. If all you require to get
back from the stub is a reservation number any reservation number then there may not be any
point in developing the stub further. If you require more complex behavior, then you will want to
develop the stub further.
Page 82 of 133 IBM Corporation 2001, 2012
12 Test Automation
12.1 Test Suites
So far, we have run all of our tests and stubs manually. This is fine while we are developing these
resources, but when we want to run large numbers of tests, this will not scale very well. We will
now look at automating our tests, which will involve two tasks the automation itself, as well as
reporting the results of these automated tests.
A test suite is a resource type providing a method of aggregating tests and/or other test suites,
which can be run in series or in parallel. Each test suite is made up of one or more scenarios; each
scenario may contain tests, performance tests, test suites, and other scenarios.
Each scenario provides configuration information for the resources inside it which environment
to use, the timing of the tests (in parallel, or spaced out), and what stubs should be executing while
the scenario is active. For more advanced test suites, scenarios also provide the ability to data drive
the tests within them, and to use probes (where a performance test license is available).
In addition, scenarios can choose to terminate or continue when a resource fails this allows
smoke tests to be carried out where necessary, but also for larger test suites to continue when all
test results are required.
4. The new suite appears with a new scenario, which is opened in its own tab in the Test
Factory. Doubleclick on the scenario icon.
5. You can now view the scenario settings. You should notice that the Environment setting is
<Undefined> this means it will use the current environment. Click OK to close the scenario
settings.
Page 83 of 133 IBM Corporation 2001, 2012
6. Add the 3 payment card tests that we created earlier. This can be done either by
a. dragging them from the Tests virtual folder under MakeBooking operation and
dropping them under the new scenario, or
b. by clicking the Add Tests button on the toolbar above the new scenario and selecting
the tests that were just created
7. Save the new suite by selecting File > Save, or clicking the Save button in Rational
Integration Testers main toolbar.
8. Run the suite by clicking Run in Rational Integration Testers main toolbar or by right
clicking the suite and selecting Run from the context menu
9. The suite is opened and executed in the Test Lab. A graphical summary of the execution is
displayed in the Task Monitor, and a detailed report of each item in the suite can be found
in the Console, in the lower portion of the window.
Page 84 of 133 IBM Corporation 2001, 2012
Results are viewed for each resource. The resource type and name can be selected along the top of
the perspective, along with the instance to be displayed (for a test suite only). The instances are
sorted by the time and date of execution of the test suite, and are named the default name is the
environment it was run in, but this can be changed, as we will see later.
Below that, we can see an execution summary for the currently selected test resource for a test
suite, this means the status of each test inside the suite. For a single test, this will display a
summary of every time that the test was executed and recorded into the database, remembering
that by default, tests are only recorded into the project database as part of a test suite or test cycle.
At the bottom of the perspective, we will see the various reports that are available. Different
reports will be available, depending on the resource that is selected above, and the configuration of
the system under test:
The Reports tab displays a summarized report for the selected test or test suite.
The Console tab displays the console output for the selected test.
The Notes tab allows you to annotate results, updating the project database.
Page 85 of 133 IBM Corporation 2001, 2012
The SCA Coverage, Tibco BW Coverage, and webMethods Coverage tabs supply coverage
reports for test suites run against environments with an Oracle SCA Domain, Tibco
BusinessWorks, or webMethods Integration Server.
The Tibco BW Errors and webMethods Errors tabs supply information on any errors
logged by Tibco BusinessWorks or a webMethods Integration Server during the execution of
a test suite.
4. If you select one of the tests in the summary pane, the Reports tab will update to show a
report detailing what took place during the test. Scroll through this you should see the test
steps that were executed, along with the messages that were sent and received.
Page 86 of 133 IBM Corporation 2001, 2012
5. While keeping the test selected, switch to the Console tab. You will now be able to see the
console information that was reported during the test. You can click on any of the links in
here to bring up the Message Differencing Window, as in the Console in the Test Lab.
6. Next, switch to the Notes tab. Here, we can edit the Label used for the test run. Set this to
InitialRun, and press Save. You should then see the label used in the Instance drop down
at the top right update to show InitialRun, rather than Local.
7. You can also add extra information in the Notes section type in some extra information
here, and press Save again.
8. Finally, view the results for the other tests. You may also like to run the test suite again; this
will give you multiple instances to choose from the Instances drop down in the top right
corner.
Page 87 of 133 IBM Corporation 2001, 2012
System tags: contain values that are provided by Rational Integration Tester, and cannot
be changed by the user. These include things like the time, the project name, and the host
name of the machine running Rational Integration Tester.
Environment tags: contain usersupplied data that can change from environment to
environment.
Test tags: contain usersupplied data that is local to a given test or stub.
In addition to these main types, you may see other types of tag. These are mainly treated as
varieties of Test tags. Some examples of these that you may encounter are:
Global tags: a test tag that has had its scope set to cover all tests in a test suite. Global
tags may be used to pass values between multiple tests in a test suite, as long as the tag is
defined in both tests, and marked as global in both tests. Outside a test suite, the scope of the
tag is limited to the current test.
Java Properties: by creating a test tag with the same name as a java property, it is
possible to access that Java property within a test or stub (for example, the Java property
file.separator).
For the purposes of this module, we will focus on the 3 main types of tag System tags,
Environment tags, and Test tags.
All tags that are available to a test or stub can be viewed from within the Tag Data Store; this dialog
can be accessed from the Tag Data Store button, or from the context menu anywhere within a
test. The image below illustrates a typical Tag Data Store. The tags are listed in alphabetical order.
Page 88 of 133 IBM Corporation 2001, 2012
You should notice that the values for environment tags reflect the currently active environment; if
you switch environments, these will update.
The tool tip for the tag under the mousepointer displays the optional description field for the tag
You can create a logical hierarchy of tags by separating multiple name sections with the / character
(e.g., JMS/URL and JMS/User will be displayed together under the JMS section).
Page 89 of 133 IBM Corporation 2001, 2012
From this tab, you can edit tags for the current environment:
New creates a new tag within the current environment, allowing you to set a value and
description within that environment. The tag is also created within all other environments,
but is not assigned a value or a description in any other environment.
Edit brings up a dialog which allows you to edit the value and description of the currently
selected tag within the current environment. Double clicking the tag will bring up the same
dialog.
Clear resets the value and description of the tag within the current environment, leaving
them undefined.
If a tag does not have a value or description within an environment, it will be listed in here as
#undefined?, and will take its value/description from the Default Properties, as discussed
previously.
Page 90 of 133 IBM Corporation 2001, 2012
New test tags need to be created within individual tests or stubs. For the most part, they will be
created from the Tag Data Store, but can also be created within certain test actions:
Create one manually by clicking on the icon within the Tag Data Store. In the Create Tag
dialog, enter the name, optional default value, and description for the new tag.
Create multiple tags by pasting a list of tag names directly into the tag data store window.
First create a list of tag names in a textbased file the names may contain / characters to
create a hierarchy as mentioned above (e.g., MYTEST/Name). Next, copy the list of tag names
and paste it into the data store window (press Ctrl + V or click the paste icon ). Blank
lines will be ignored when pasting tags.
Use the Quick Tag option within a test step to automatically create a tag with a name
corresponding to a particular message field.
8. Run the test in the Test Lab view, and watch the console you should see the names of the
test and environment.
9. Tags can also be used to record inputs and outputs for test steps. As a basic example, were
going to log the reservation number returned by the system. To do this, return to the Test
Factory perspective, and open the Receive Reply step.
10. The Receive Reply properties will open up switch to the Store tab. This is where we can
configure which data fields will be required for later use.
11. At the bottom of the dialog, find the newReservationNumber field. Right click on it, and select
Contents > Quick Tag. A tag name should appear in the
column, and the checkbox
in the column should be ticked. Note that these columns can also be filled in manually, if
you require a particular name for a field.
12. Press OK to close the Receive Reply step, and add another Log step to the end of the Test
Actions. The contents of this Log action should be:
ReservationNumber:%%newReservationNumber%%
You can either type this in directly, or use the same method used for the previous log action.
13. Save the test and run it again. The console output should now include the reservation
number that was generated by the booking process.
File Data Source reads data from an individual file. This may be something like a CSV file,
fixed width, or other delimited file.
Database Data Source reads data from a table in a database, or the results of a query on a
database. The database must be set up in Architecture School before this data source may be
created.
Directory Data Source reads in a set of files (for example, a set of XML documents).
1. Return to the Test Factory view, and create a new test using the basicTemplate test
template. Call it dataDrivenTest.
2. Open the dataDrivenTest, and bring up the properties for the Send Request step of the
test.
3. Go to the Config tab of the test action.
4. Click on the tns:flightNumber(Text) field, then use Ctrl+click to select each of the
following (Text) fields, down to tns:passengerGender. Do not select the (Element) fields,
or later stages of the exercise will fail.
5. Right click and select Contents > Quick Tag. The message structure should now appear as
below, with tags created for each of the selected fields:
10. Next, well need to select the tags wed like to use, so press the Select Test Data Columns
button.
11. A Select Tags window will appear drag to select all of the tags that are listed there, then
press Select.
12. In the Action section of the dialog, choose to Use this test data in a new action of type
Iterate Test Data and insert after Test Steps.
13. Make sure that the box labeled Edit Excel data on OK is checked. The dialog box should
now look like the following:
14. Press Finish. Libre Office will launch, displaying the spreadsheet that has been created. The
first row of the spreadsheet will contains headings that match the tag names from the data
source. The second row of the spreadsheet should contain the values that were in the
original message before we tagged the fields. This is due to two things: firstly, when we
created the tags, the default value of each one was set as the values given inside the message
Page 94 of 133 IBM Corporation 2001, 2012
we quick tagged. Secondly, the spreadsheet generated used those default values of each tag
as the first row of data.
15. In addition to this row of data, add 3 more rows of passenger information, then save the
document and close Libre Office.
16. Return to Rational Integration Tester. In the Test Factory Tree, there should now be a Test
Data set called PassengerData. Open this, so we can validate that everything has been set up
correctly.
17. The File Name should point towards the same location that we saw in the wizard. The Sheet
name will be blank this is fine, as the default setting is to use the first sheet in the
workbook. Under the Format Configuration section, A row of the file contains column
names should be checked, with 0 rows before and after the column names. Check that this is
correct, then press the Refresh button at the bottom of the screen. You should now see the
data that you entered into the spreadsheet.
18. Close the PassengerData data source, and return to the dataDrivenTest.
19. This should have three test actions an Iterate Test Data, a Send Request, and a Receive
Reply. To make sure that we send a request and receive a reply for each line of data, drag
and drop the Send Request and Receive Reply actions onto the Iterate Test Data action.
Your test should now look like the following image:
Page 95 of 133 IBM Corporation 2001, 2012
20. Save the DataDrivenTest. Return to the Test Lab perspective, and run the test. You should
see a Send Request and a Receive Reply line in the console for each row of data in your
spreadsheet.
Note: Whenever changes are made to the test data source from within Rational Integration Tester
(for example, the file name), the test data source will need to be saved. Until you save the data
source, other parts of Rational Integration Tester will not know about those changes so in this
exercise, for example, the Iterate Test Data action will not be aware of changes to the chosen sheet
name if you do not save the data source first. Note that this only applies to configuration settings
controlled inside Rational Integration Tester you do not need to save the data source again if an
extra column is added to the data source, for example.
Page 96 of 133 IBM Corporation 2001, 2012
14 Repeating Elements
14.1 Overview
This example looks at how messages containing repeating and optional elements may be handled
with Rational Integration Tester; in particular, how to data drive tests containing such messages.
For the example, XML messages will be sent and received over MQ, but the steps will be much the
same for other technologies.
Consider the order.xsd example (included in the RepeatingElements folder) that is used to create
messages for publishing and validating.
The XML Schema contains an item element that can be repeated multiple times in the message.
<xs:elementname="item"maxOccurs="unbounded"type="itemtype"/>
Within the item element, there is another repeating discountcode element which is also optional
and so may not be needed.
<xs:elementname="discountcode"type="stringtype"minOccurs="0"
maxOccurs="unbounded"/>
When matched with the OrderTestData.xls test data we get the five orders specified below.
Without the Repeating Elements functionality a user would manually need to create five tests. This
functionality allows the user to define a single message that makes use of repeating elements to
dynamically build the message from the test data set and time of publishing or subscribing.
Page 97 of 133 IBM Corporation 2001, 2012
Expected XML Messages 15
Page 98 of 133 IBM Corporation 2001, 2012
5. Now navigate to the Schema Library and import a new XSD . Select the supplied XML
schema, order.xsd, which can be found in the DataFiles\RepeatingElements folder on
your desktop.
6. After importing, select XSDs on the left hand side of the Schema Library you should now be
able to view the order schema.
7. Optionally, you can return to the PublishOrders operation to set the Message Exchange
Pattern to Publish, and to use the schema you have just imported; we will not be making
use of the MEP in this exercise, but if you wish to create other tests using MEP, this will be
useful.
Page 99 of 133 IBM Corporation 2001, 2012
8. Otherwise, switch to the Test Factory. We will now create a data source to import our data.
Rightclick on the PublishOrders operation and select New>Test Data>Excel Data Source.
Call the data source OrderData.
9. In the configuration pane, press Browse and find the OrderTestData.xls file found in the
RepeatingElements folder. Following that, check the box labeled Treat empty strings as
null. This will allow the tool to group nested data correctly. After pressing the Refresh
button, you should see the following data in the Preview pane:
10. Save the data source, and then close it.
11. We will now create a test to process this data. Rightclick on the PublishOrders operation
and select New>Tests>Test. Call it TestOrders.
12. Add an Iterate Test Data action to the Test Steps. Create, then drag and drop a Publish
action, followed by a Subscribe action and then a Log action onto the Iterate Test Data
action. Your test should look like the following:
13. Doubleclick on the Publish action and configure it:
Page 100 of 133 IBM Corporation 2001, 2012
Page 101 of 133 IBM Corporation 2001, 2012
14. Next, well configure the Subscribe action to retrieve the message that weve just sent, and
hold the entire XML message in a single tag. Open up the Subscribe action and configure it
as follows:
o Use the same transport settings as the publish action (receiving a message from
WWTravel_MQ, using queue.orders)
o Disable validation on the text(String) part of the message.
o Switch to the Store tab, and save the value of the incoming message by quick tagging
the text(String) field.
o Click OK to close the test action.
15. Open the Log action, add %%text%% as the text message, then close the test action.
16. We now have to map the test data to the tags defined in the Publish action. Doubleclick on
the Iterate Test Data action to configure it:
o In the Config tab, Browse to the OrderData for the Test data set.
o In the Group data by column field select id.
o Switch to the Store tab and check that each field in the Tag name column has been
mapped appropriately to the incoming Data. This should have been done for you
automatically, but if you did not have the tags in the test prior to setting the data
source for this test action, it would not be done for you; similarly, if you did not save
the data source earlier, this mapping will not have taken place.
o Close the Iterate Test Data action.
17. Save the test, and run it in the Test Lab.
18. You should see the test pass and in the console you should see five order messages,
corresponding to the messages described previously. As an example, the final message is
shown below:
Page 102 of 133 IBM Corporation 2001, 2012
Page 103 of 133 IBM Corporation 2001, 2012
15 Test Actions
Test actions are the main building blocks of our tests. So far, we have seen just a couple of the
actions that are available to us. Over the course of the next couple of chapters, we will look at a
number of the other actions available in Rational Integration Tester.
Message Case: Filter the message received by the parent Message Switch.
Page 104 of 133 IBM Corporation 2001, 2012
Flow Actions
Assert: Check that a given condition is satisfied before the rest of the test
steps can be executed.
Pass: Automatically pass the test. No subsequent actions within the Test Steps
phase will be executed.
Fail: Automatically fail the test. No subsequent actions within the Test Steps
phase will be executed.
Iterate Test Data: Repeat test steps for a given data set.
Fetch Test Data: Retrieve a row of test data from a data set.
Lookup Test Data: Lookup test data from a data set; Test actions will branch,
dependent on whether the lookup is successful.
Page 105 of 133 IBM Corporation 2001, 2012
User Interaction: Ask the user to interact with the test as it runs.
Compare Files: Compares two logical file sources (both of which may be
directories) containing record data.
Page 106 of 133 IBM Corporation 2001, 2012
8. Press the Test button to execute the command a new notepad window should appear. You
can safely close this straight away.
9. Click OK to close the dialog, and switch to the Test Lab.
10. When you run the test, it should pass and a notepad window should appear again.
Page 107 of 133 IBM Corporation 2001, 2012
8. Set the output file to the reservationData.csv file created at the beginning of this exercise.
9. Make sure that the Append checkbox is ticked. This will make sure that we add new log
information to the end of the file, rather than overwriting any previous contents.
10. The Role field should be set to Info by default check that this is the case.
Page 108 of 133 IBM Corporation 2001, 2012
11. Close the Log action, and run the test in the Test Lab.
12. Open the reservationData.csv file to verify that it has the details of the customer from the
test weve just run, and then close the file without making any changes.
13. Go back to the Log action in the Test Factory, and change the Role to Error. Observe what
happens when you run the test.
14. Change the Log action again to use a Role of Warning, and observe what happens to the test
when you execute it this time.
15. Go back to the Log action one last time, and change the Role back to Info.
action to the
7. On the Config tab, choose to Browse for the data set, and select the ReservationLog data.
8. You will need to add a lookup, using a Column Key of ReservationNo, and a Lookup Value
of %%newReservationNumber%% . Close the test action.
9. When we perform this lookup, we expect that we will not find any duplicates the
reservation numbers should be unique for each reservation. If we do find a duplicate, then
we want to report this. You should see that the Lookup action comes with two paths below it
Page 109 of 133 IBM Corporation 2001, 2012
Found and Not Found. Right click on the Found option, and add a new Log action to this
path.
10. The new Log action should report that the reservation number is a duplicate. It should not
be added to any file, but will need to have a Role of Error. Once you have set the role and
entered an error message, close the Log action.
11. If we dont find the reservation number in the previous log, then the test has succeeded, and
we will want to log the current data. This can be done simply by dragging and dropping the
Log action created in the previous exercise onto the Not Found path.
12. Save the test and run it against the Worldwide Travel system. It should succeed, and new
data will be added to our log file. As the system always produces a new reservation number,
the test should pass each time.
13. However, we can anticipate what the next reservation number will be, and insert that
number into the log file that weve created. This would fool the test into thinking it had
found a duplicate reservation number. Open the log file, and edit it so that there is an entry
for the next reservation number. Save the file, then run the test again you should now see it
fail.
14. The Lookup Test Data action can also be used to retrieve information from the data source.
If we find a duplicate, well report the first and last names of the customer recorded in the
file. To do this, return to the Test Factory, right click in the Test Steps, and open the Tag
Data Store.
15. Press the button in the Tag Data Store to add a new tag to the test call it logFirstName.
Do this one more time, and create a second tag called logLastName. Close the Tag Data Store.
16. Open the Lookup Test Data action, and switch to the Store tab.
17. In the Output format, select Store one matching row only. As were attempting to prevent
any duplicates, we wont expect to find more than one row of data inside the log file for each
reservation number.
18. In the Mappings section, you will see the FirstName and LastName fields from the data
source. Click on the FirstName row a pencil
button to bring up the Select Tags dialog.
Page 110 of 133 IBM Corporation 2001, 2012
21. Close the test action, and amend the Log action used for reporting errors, so that it looks like
the following:
22. Save the test.
23. Take note of the most recent reservation number, and again make sure that there is an entry
for the following reservation number in your log file. So that we can verify that data is being
extracted from our data source, choose new first and last names for this new entry.
Remember to save the log file after making any changes.
24. Run the test again. You should now see a duplicate, and the name shown in the console
should be the one that you entered in the previous step.
The Pass and Fail actions cause a test to pass and fail respectively; test execution will skip
straight to the Tear Down phase of the test, ignoring any further actions within the Test Steps
phase. Well now create a simple test to illustrate how to implement these features, and then
discuss some of the more advanced real world applications.
3. Go to the Test Lab, and run the test again. It should now fail, as its no longer receiving the
expected reservation number.
4. Were going to modify the test so that it will pass with a warning if there an issue validating
the reply message. Anything else should still cause the test to fail (transport failure, timeout,
Page 112 of 133 IBM Corporation 2001, 2012
etc). Return to the Test Factory, right click on the Receive Reply step, and choose Add
Failure Path.
5. Right click on Subscriber Error and select New > Flow > Fail. Double click on the Fail test
step and add some text into the Output Message box, e.g. Messagetimeout. Click OK.
6. Right click on Validation Failure and select New > Flow > Log. Double click on the Log test
step and some text into the Output Message box, e.g. Validationfailed. Set the Role of
the action to Warning. Click OK.
7. Your test should now look like this:
10. In the Test Factory, open the Receive Reply step. Find the Timeout field, and set it to 5 ms.
Run the test again, and you should see it fail this time, as the error does not occur at the
validation stage.
Page 113 of 133 IBM Corporation 2001, 2012
Now that weve constructed a simple example to help understand the basic idea behind Failure
Paths and Pass/Fail actions, we can look at a more advanced example thats more applicable to the
real world.
The above diagram shows a standard example SOA system. Service 1 receives a message and passes
this message on to Service 2, the message is then passed from Service 2 to Service 3 and back again,
onward to Service 4 and back, and finally back to Service 1. If at any point an error occurs, the
message is passed to an exception queue.
You could setup a basic test in Rational Integration Tester that publishes a message to Service 1,
along with a subscriber to receive the reply. A second subscriber can be setup however to listen on
the Exception Queue. If this subscriber times out then it means nothing has been placed on the
Exception Queue and so the test should pass. However if the subscriber receives a message then
there has been an error as so the test should fail.
This functionality can be achieved by adding a Failure Path to the subscriber, and adding a Pass
action to the Subscriber Error and a Fail action to the Validation Failure. (If a timeout occurs it will
trigger a Subscriber Error and so pass, if a message is received it will trigger a Validation Error and
fail)
Page 114 of 133 IBM Corporation 2001, 2012
11. Add the SQL Query action to the test. Edit the action, and hit the Browse button to select
the TestDatabase. If you do not see the TestDatabase, set Obey References to No. This
will ignore any dependencies set in Architecture School, and show all databases within the
project.
12. Enter the following SQL Query:
SELECT*FROMreservation
ORDERBYreservation_number
13. Click on Test. If Rational Integration Tester shows an error message, check that you have
entered the query correctly, and that the TestDatabase has been selected at the top of the
window. Otherwise, you will see the contents of the Reservation table.
Page 116 of 133 IBM Corporation 2001, 2012
14. Click on Overwrite Expected Results and click OK to close the SQL Query window.
15. Run the test it should pass. We havent altered the database, so the expected and actual
results of the query will match.
3. Select any cell, and press the Edit Cell button. Alternatively, right click on the cell, and
choose Edit Cell.
4. Note that you can edit the validation for this particular cell. By default, the validation should
have an Action Type of Equality, and the value should be set to whatever value is currently
in the database within that field. Close this validation window without making any changes.
5. Similarly, to edit validation rules for a column, we can select any cell within the column, and
press the Edit Column button, or we can right click on the column heading, and choose
Edit Column. Open the validation rules for the gender column.
6. Press the New button to add a new validation rule choose to evaluate the contents of the
column with an Action Type of Regex.
7. For the regular expression, enter ^(Male|Female)$
8. This should let us accept either Male or Female as valid entries; anything other than these
exact strings will fail. Check this by typing into the Document field, and verifying that these
values pass, and others fail, when you press the Test button.
9. Once you are satisfied that the regular expression is working here, press OK to close the
dialog. Add more validation rules for other columns, using regular expressions as follows:
week_number
^\d{1,2}$
flight_number
^WW\d{3}$
reservation_number
^A\d{6}$
10. These rules can be used to generalize how query results will be evaluated. However, we still
have the original cell assertions, which state that each cell must be equal to the values we
Page 118 of 133 IBM Corporation 2001, 2012
can see in the table in this dialog. In order to make things more general, check the box
labeled Disable Cell Assertions. This will mean that only the column assertions are used.
11. Press OK to close the dialog, and run the test. You should see that the test passes.
12. Return to the Test Factory, and modify the InsertTest so that it uses an invalid reservation
number (for example, change the A at the beginning to B).
13. Run the modified InsertTest, and then run the columnValidations test one more time. The
columnValidations test should fail, pointing out the invalid reservation number.
14. In the next exercise, well reset the database to its original state, allowing both query tests to
pass again.
Page 119 of 133 IBM Corporation 2001, 2012
17 Run Test
17.1 Introduction
The Run Test feature allows you to run one test from inside another. This allows you to create tests
with reusable functionality and run them from multiple different tests within your project. This is
similar to the idea of creating reusable methods in object orientated programming.
Essentially, if there is a task that many tests will need to perform (e.g. resetting a database, starting
up a number of external applications etc), then you can create a single reusable test that performs
that task, rather than rewriting those actions for every test. You can then reuse this test wherever
necessary within other tests to perform the required task.
In this section well create a modified Insert Record test that inserts a given record into a
database, using tags rather than hardcoding the values to be inserted into the database. Well then
use this as part of a separate test to reset the database. As part of this process, well also see how we
can pass data from one test to another.
4. You will notice that all of the tags are underlined. This is because they do not exist yet. Open
up the Tag Data Store and create them now.
5. Reopen the SQL Command action and check the tags are no longer underlined.
6. We wont run this test as the default value for a new tag is null, wed only be inserting null
values into the database. Instead, simply Save the test.
You may be wondering why every tag starts with ChildTest. This is to help us identify which tags
belong to which test, and will be very useful when we come to pass data between the parent and
child tests.
Page 120 of 133 IBM Corporation 2001, 2012
We will now create a test that will reset a database by removing all current records then entering a
selection of supplied records. We will do this via the Run Test action calling our Insert Record
test.
8. These tags will store the values of each attribute read in from the CSV file. As the CSV file
contains multiple records, were going to make use of the Iterate Test Data action to
apply an action to each record in the CSV file.
9. Add an Iterate Test Data
Page 121 of 133 IBM Corporation 2001, 2012
10. Open it, press the Browse button and select the DBResetData data source.
11. Go to the Store tab. You should see a list of the tags you created. Select the drop down menu
to the right of each tag and select the appropriate attribute. Click OK. This sets the value of
the tags in the test to the values of each column in the data source.
12. Right click on the Iterate Test Data action and select New > Flow > Run Test.
13. Open up the Run Test action, click the Browse button and select the InsertWithTags test
you created earlier. Uncheck Run process in parallel. The test should now look like so:
Page 122 of 133 IBM Corporation 2001, 2012
7. Go to the Test Lab, and run the ResetDatabase test.
The ResetDatabase test runs an iteration of the InsertWithTags test with the tags in Insert
Record set to the values specified in the Reset Database test (which are set according to the values
read in from the CSV file). The Iterate Test Data action is used to run the Insert Record sub test
once for each record stored in the test data.
You may question the need to use a Run Test action in this situation, as you could simply have the
Iterate Test Data action run a SQL Command directly. If you had a single parent test and a single
sub test then this would probably be true. However imagine that you have many tests that all insert
records into the database. You could have a separate SQL Command action in every single one, but
if the database changes (e.g. a field is removed) then youll have to go through every test separately
and make the appropriate changes. If you use the Run Test feature however, you only need to
make the change in a single sub test.
Another advantage of using a sub test can be seen if you imagine that instead of the sub test
containing a single SQL Command action, it contains 50+ commands along with decision steps etc. If
you want to do such a complicated action more than once in different tests throughout your project,
the Run Test action helps save a lot of time. Once again anyone with programming experience will
notice the similarities between this and the idea of reusable methods in computer code.
Page 123 of 133 IBM Corporation 2001, 2012
5. In Test Factory, create a new empty test under the MakeBooking operation, and call it
MonitorTest.
6. Add two Log actions to the test, one to say Starting Test, and the other to say Test
Finished.
7. As we will update our log file by hand, we will need the test to pause for a short period. To
do this, well use a Sleep action. Set it to for a Fixed delay, of 20000ms. Your test steps
should now look like the following:
8. Switch to the Monitoring tab of the test, and choose Add it should automatically find the
log file location we selected in Architecture School.
9. Find the Actions tab, and switch to that to tell the test how to respond to changes within the
log file.
10. Press the Add button to add a new action.
11. Double click in the Match field. It should bring up an Edit Regex window, with a copy of the
log file as it currently stands.
12. We want to respond if an error is logged select the text [ERROR].
13. A popup will appear with regexes that match the selected text. Choose the Exact option
\[ERROR\]. It should now appear at the bottom of the dialog, and the [ERROR] text should
now be highlighted, as below. Press OK to return to the test.
14. Under Action, choose Treat as error, and mark the Enabled checkbox.
15. Save the test, and go to Test Lab.
Page 125 of 133 IBM Corporation 2001, 2012
16. Run the test. While it is sleeping, edit the example.log file provided in the DataFiles
folder on your desktop to add another line starting with [ERROR], and save the log file.
17. Rational Integration Tester should detect the change, and the test will fail.
Note: If Rational Integration Tester does not show any errors, make sure that you have edited and
saved the file within the 20 seconds provided by the Sleep action. In addition, default settings for
reading the log file (set in Architecture School) state that new entries in the log file must end in a
new line simply adding [ERROR] without a new line will not register an error in your test.
Page 126 of 133 IBM Corporation 2001, 2012
19 Advanced Stubs
19.1 Exercise: Parameterized Stubs
In this exercise, you will create a parameterized stub. This is more complex than the basic stub we
created earlier, in that it will produce different reply messages when given different request
messages.
1. To start collecting data to generate the stub, go to the Recording Studio. Clear any
messages recorded previously.
2. Check that the MakeBooking operation is being monitored, and start recording.
3. Switch to the Test Lab, and run the test suite created earlier. Return to the Recording
Studio, and you should see the messages produced for that set of tests.
4. Select MakeBooking within the Event Monitors. This should filter out any other events,
leaving you with just the 6 MakeBooking requests and responses that were recorded. Check
these to make sure that you have a request message for each of the three card types allowed
by the booking system. If not, youll need to record more interactions with the system. If
youve got too many, then delete any extras from the Events View.
5. Select all 6 events, and press the Save button.
6. Again, well choose to save them as a stub in the first page of the wizard. Press Next once
youve done this.
7. On the second page of the wizard, choose to Store data in a simple data set. Press Next.
8. The third page checks that everything has been allocated to the correct operation. You
should see 6 events, all labeled as being related to the MakeBooking operation. If so, press
Next. If not, youll need to go back and make sure youve selected the right events.
9. The fourth page checks that the requests and replies have been grouped correctly. Again,
this should already be the case, but you can choose to change groupings here or restart if
necessary. Press Next once youre satisfied that this is correct.
Page 127 of 133 IBM Corporation 2001, 2012
10. Youll then get a preview of how the request messages will be mapped into our data set.
Rational Integration Tester will analyze the messages used in the recorded messages, and
look for differences between the messages. By default, it will record data that changes into
columns within the data set; data that appears to be static will not be included. Take a look
at the request message fields that are going to be included in the data set have a status of
New
, while those that are not going to be included are listed as Ignored
.
11. Within the request message, we only care about the card type, so select each of the other
fields, and press the Ignore
button. This should leave only the card type listed as New,
and everything else Ignored. Press Next to go to the response message for MakeBooking.
12. Here, we can see that the reservation number is also marked as New. In this case, we may
also decide that we are interested in the status field as well, even though it had the same
value in each of the recorded messages. Find the status row, which should be marked as
Ignored. Select it, and press the Column
button.
13. A popup dialog will appear, allowing you to name the column that will be created for the
status within our data source by default, it will be called status. This will be fine for our
purposes, so press OK. Both the reservation number and the status should now be marked
as New.
14. Press Next again to go to the summary screen. This should inform you that a stub will be
created, along with a data source containing information about the card type, reservation
number, and status. If different fields are listed, youll want to hit back to return to the
previous steps, and make sure that each field is being added to the data set or ignored, as
required.
15. Call the stub BookingsWithData, and go to the Test Factory to view what weve produced.
16. Under the MakeBooking operation, you should see two things with the name
BookingsWithData. We have a stub, as weve had every other time, but we also have a data
source. Double click on this within the Test Factory Tree to open it.
Page 128 of 133 IBM Corporation 2001, 2012
17. The first thing you might notice is that the file name contains a reference to the root
directory of a project, written in gold and surrounded by percentage signs. This is a system
tag a variable internal to Rational Integration Tester, which we cant edit directly. This
allows us to refer to the project folder, no matter where that might be located. If the project
is moved to another folder or another machine, the link to the CSV file that were using will
still function.
18. Press the Refresh button at the bottom of the screen to view the data within the data source
this should contain the three card types and reservation numbers we recorded previously,
along with a status column that states SUCCESS for each. There is also a grouping column
provided for us, in case we had recorded data with repeating elements (which would require
multiple lines of data). As our data is fairly simple, we dont need to worry about this for
now. Close the data source.
19. Open the stub itself, and look at the Input tab. You should notice that the card type is being
stored into a tag.
20. Switch to the Output tab, and youll notice that no response is being sent here in fact, no
response message appears to be present at all. This is because the stub that we have
generated will respond if it recognizes a familiar card type, but otherwise will ignore any
incoming messages. To see how we handle this, switch to the Business Logic tab.
21. The Business Logic tab allows us to specify our own custom logic to dictate how the stub
will respond to incoming messages. Here, you can see a Lookup Test Data action, which is
Page 129 of 133 IBM Corporation 2001, 2012
followed by two options Found and Not Found. If the lookup is successful, it will send a
reply. If not, it will do nothing. Open the Lookup Test Data action by double clicking on it.
22. This has two tabs the Config tab will open by default. As you should be able to see, were
trying to match the value that we stored into the cardType tag in the Input tab with the
cardType column in the data source.
23. Switching to the Store tab, youll be able to see that were going to save the data from the
columns in the data source into corresponding tags within the stub (with the exception of
the grouping tag). This will only happen if we find a match otherwise, any values that may
exist within those tags will be left alone. Close the Lookup Test Data Action.
24. Open the Send Reply action. This will be used to send a reply if and only if we found a match
within the Lookup Test Data action.
Page 130 of 133 IBM Corporation 2001, 2012
25. Observe the message that is being sent back this uses the values that were saved into the
status and newReservationNumber tags within the Lookup Test Data action, so these
values will be coming directly from our data source. Close the Send Reply action.
Run the stub, and send some requests to it (either by running tests, or by creating requests using
the web interface). You should notice that each card type gets its own reply, based on the data
source.
Page 131 of 133 IBM Corporation 2001, 2012
20 Legal Notices
The following paragraph does not apply to the United Kingdom or any other country where
such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES
CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied
warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are
periodically made to the information herein; these changes will be incorporated in new
editions of the publication. IBM may make improvements and/or changes in the product(s)
and/or the program(s) described in this publication at any time without notice.
If you are viewing this information in softcopy, the photographs and color illustrations may
not appear.
Any references in this information to nonIBM websites are provided for convenience only
and do not in any manner serve as an endorsement of those websites. The materials at those
websites are not part of the materials for this IBM product and use of those websites is at
your own risk.
Any performance data contained herein was determined in a controlled environment.
Therefore, the results obtained in other operating environments may vary significantly.
Some measurements may have been made on developmentlevel systems and there is no
guarantee that these measurements will be the same on generally available systems.
Furthermore, some measurements may have been estimated through extrapolation. Actual
results may vary. Users of this document should verify the applicable data for their specific
environment.
Information concerning nonIBM products was obtained from the suppliers of those
products, their published announcements or other publicly available sources. IBM has not
tested those products and cannot confirm the accuracy of performance, compatibility or any
other claims related to nonIBM products. Questions on the capabilities of nonIBM products
should be addressed to the suppliers of those products.
All statements regarding IBM's future direction or intent are subject to change or
withdrawal without notice, and represent goals and objectives only.
This information contains examples of data and reports used in daily business operations.
To illustrate them as completely as possible, the examples include the names of individuals,
companies, brands, and products. All of these names are fictitious and any similarity to the
names and addresses used by an actual business enterprise is entirely coincidental.
This information contains sample application programs in source language, which illustrate
programming techniques on various operating platforms. You may copy, modify, and
distribute these sample programs in any form without payment to IBM, for the purposes of
developing, using, marketing or distributing application programs conforming to the
application programming interface for the operating platform for which the sample
programs are written. These examples have not been thoroughly tested under all conditions.
IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these
Page 132 of 133 IBM Corporation 2001, 2012
programs. The sample programs are provided "AS IS", without warranty of any kind. IBM
shall not be liable for any damages arising out of your use of the sample programs.
Trademarks and service marks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., registered in many jurisdictions worldwide. Other product and
service names might be trademarks of IBM or other companies. A current list of IBM
trademarks is available on the web at www.ibm.com/legal/copytrade.shtml.
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other
countries, or both.
Java and all Javabased trademarks and logos are trademarks or registered trademarks of
Oracle and/or its affiliates
Other company, product, or service names may be trademarks or service marks of others.
Page 133 of 133 IBM Corporation 2001, 2012