Contenu connexe
Similaire à Rit 8.5.0 integration testing training student's guide (20)
Rit 8.5.0 integration testing training student's guide
- 3. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
OVERVIEW .................................................................................................................................... 4
1
PREPARATION ......................................................................................................................... 5
1.1
1.2
CONFIGURING THE LIBRARY MANAGER FOR WEBSPHERE APPLICATION SERVER AND MQ ...... 5
1.3
2
INTRODUCTION ................................................................................................................. 5
INTERCEPT FOR WEBSPHERE MQ ...................................................................................... 7
PROJECT SETUP ...................................................................................................................... 8
2.1
2.2
CREATING A NEW PROJECT ................................................................................................ 9
2.3
3
THE INITIAL SCREEN .......................................................................................................... 8
EXERCISE: CREATING A NEW PROJECT ............................................................................. 10
COMPLEX ENVIRONMENTS ...................................................................................................... 13
3.1
3.2
MANAGING FLIGHT BOOKINGS .......................................................................................... 13
3.3
FINDING AND BOOKING HOTELS ........................................................................................ 14
3.4
4
INTRODUCTION ............................................................................................................... 13
FLIGHT ADMINISTRATION .................................................................................................. 15
SYNCHRONIZATION ................................................................................................................ 17
4.1
4.2
5
INTRODUCTION ............................................................................................................... 17
EXERCISE: SYNCHRONIZING WITH A WEBSPHERE APPLICATION SERVER ............................. 18
BUILDING A SYSTEM MODEL FROM RECORDED EVENTS ............................................................. 21
5.1
5.2
RECORDING MQ MESSAGES ............................................................................................ 21
5.3
EXERCISE: SETTING UP THE TRANSPORTS ......................................................................... 22
5.4
EXERCISE: ADDING THE FLIGHT BOOKING MESSAGE SCHEMAS ............................................ 23
5.5
EXERCISE: RECORDING EVENTS FROM A TRANSPORT ......................................................... 24
5.6
EXERCISE: BUILDING OPERATIONS FROM RECORDED EVENTS ............................................. 26
5.7
6
INTRODUCTION ............................................................................................................... 21
EXERCISE: COMPLETING THE SYSTEM MODEL .................................................................... 33
MANAGING RECORDED MESSAGES .......................................................................................... 36
6.1
6.2
EXERCISE: RECORDING EVENTS FROM AN OPERATION ....................................................... 36
6.3
7
INTRODUCTION ............................................................................................................... 36
ADVANCED EXERCISE: CREATING AND RUNNING TRIGGERS ................................................. 39
CREATING TESTS FOR VACATION BOOKING ............................................................................. 41
7.1
INTRODUCTION ............................................................................................................... 41
7.2
THE TESTS USING MEP WIZARD....................................................................................... 41
7.3
REGULAR EXPRESSIONS .................................................................................................. 42
7.4
EXERCISE: CREATING TESTS WITH THE MEP WIZARD ......................................................... 42
Page 1 of 127 © IBM Corporation 2001, 2013
- 4. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
7.5
COPYING AND LINKING REQUIREMENTS ............................................................................. 47
7.6
TEST TEMPLATES ............................................................................................................ 48
7.7
EXERCISE: CREATING A TEST FROM A TEMPLATE ............................................................... 48
8
REPAIRING TESTS .................................................................................................................. 50
8.1
INTRODUCTION ............................................................................................................... 50
8.2
EXERCISE: REVIEWING TEST RESULTS .............................................................................. 50
8.3
EXERCISE: REPAIRING TESTS ........................................................................................... 51
8.4
THE RULE CACHE ........................................................................................................... 55
8.5
EXERCISE: CREATING VALIDATION RULES .......................................................................... 55
9
CREATING AND RUNNING A STUB ............................................................................................ 57
9.1
EXERCISE: CREATING A STUB FROM RECORDED EVENTS .................................................... 57
9.2
EXERCISE: EXECUTING A STUB FROM RATIONAL INTEGRATION TESTER ............................... 59
10
STORING AND MANIPULATING DATA ..................................................................................... 62
10.1
TAGS AND THE TAG DATA STORE .................................................................................. 62
10.2
CREATING TAGS .......................................................................................................... 63
10.3
USING TAGS ................................................................................................................ 65
10.4
EXERCISE: TESTING WITH TAGS .................................................................................... 65
11
DATA DRIVEN TESTS ........................................................................................................... 68
11.1
DATA SOURCES ........................................................................................................... 68
11.2
EXERCISE: DATA DRIVEN TESTING ................................................................................. 68
11.3
OPTIONAL AND REPEATING ELEMENTS ........................................................................... 73
11.4
AN EXAMPLE OF REPEATING ELEMENTS.......................................................................... 73
11.5
EXERCISE: ADDING THE NEW OPERATION AND SCHEMA ................................................... 76
11.6
EXERCISE: CREATING THE REPEATING ELEMENTS TEST ................................................... 77
12
TEST ACTIONS ................................................................................................................... 81
12.1
TEST ACTION SUMMARY................................................................................................ 81
12.2
EXERCISE: RUN COMMAND .......................................................................................... 84
12.3
EXERCISE: LOG ........................................................................................................... 86
12.4
EXERCISE: LOOKUP TEST DATA .................................................................................... 88
12.5
FAILURE PATHS AND PASS PATHS................................................................................. 92
12.6
THE PASS AND FAIL ACTIONS ........................................................................................ 92
12.7
EXERCISE: USING FAILURE PATHS ................................................................................ 92
12.8
FAILURE PATHS AND EXCEPTION QUEUES ...................................................................... 94
13
INTERACTING WITH DATABASES........................................................................................... 96
Page 2 of 127 © IBM Corporation 2001, 2013
- 5. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
13.1
INTRODUCTION ............................................................................................................ 96
13.2
EXERCISE: CREATING A DATABASE COMPONENT MANUALLY ............................................ 96
13.3
EXERCISE: SQL COMMAND .......................................................................................... 98
13.4
EXERCISE: COLUMN AND CELL VALIDATIONS ................................................................ 100
14
RUN TEST ....................................................................................................................... 102
14.1
INTRODUCTION .......................................................................................................... 102
14.2
EXERCISE: CREATING THE CHILD TEST......................................................................... 102
14.3
EXERCISE: CREATING THE PARENT TEST...................................................................... 103
14.4
EXERCISE: PASSING DATA BETWEEN THE TESTS ........................................................... 105
14.5
CONCLUSION............................................................................................................. 106
15
MONITORING LOG FILES .................................................................................................... 107
15.1
OVERVIEW ................................................................................................................ 107
15.2
EXERCISE: LOOKING FOR ERROR MESSAGES ................................................................ 107
16
ADVANCED STUBS............................................................................................................ 111
16.1
17
EXERCISE: PARAMETERIZED STUBS ............................................................................. 111
FURTHER TEST AUTOMATION............................................................................................. 117
17.1
INTRODUCTION .......................................................................................................... 117
17.2
EXERCISE: PASSING TAGS BETWEEN TESTS ................................................................. 117
17.3
MANAGING TEST RESULTS .......................................................................................... 119
17.4
EXERCISE: MANAGING TEST RESULTS.......................................................................... 120
18
RUNNING TESTS EXTERNALLY ........................................................................................... 123
18.1
INTRODUCTION .......................................................................................................... 123
18.2
EXERCISE: SCHEDULING TESTS .................................................................................. 123
19
LEGAL NOTICES ............................................................................................................... 126
Page 3 of 127 © IBM Corporation 2001, 2013
- 6. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
Overview
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:
Deal with complex, multi‐component architectures, looking at how to model and test those
within Rational Integration Tester
Examine advanced functions of Recording Studio
Work with several advanced features of tests:
o Create tests using templates
o Update tests based on their results
o Use data files to determine how tests will be run
o Work with the various test actions available inside tests
o Test against databases
o Monitor log files
Build test suites
Run tests and test suites outside Rational Integration Tester.
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 127 © IBM Corporation 2001, 2013
- 7. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
1 Preparation
1.1 Introduction
When working with proprietary middleware technologies, there will often be a certain amount of
configuration that needs to be carried out before you can begin to work with that technology from
Rational Integration Tester. In most cases, you will need to set up the various Java libraries that
allow connectivity to that technology. In a few cases, you might also need to perform other setup to
enable recording and virtualization on that particular platform.
In the example system used in this course, you will be using a number of IBM technologies. Some of
these require more setup than others. The simplest one of these is IBM DB2. Rational Integration
Tester includes drivers for a number of databases, including DB2, so no further setup needs to be
done for these in order to run tests against them. Note that you might need to do further setup for
recording or virtualization of JDBC connections, but that is outside the scope of this course.
The second item you will need to work with is the WebSphere Application Server. While there is
some setup to be performed here, it is still quite simple. You will need to tell the Library Manager
where certain Java libraries provided with the WebSphere Application Server can be found.
Provided you have installed the application server into the default location, you can expect Library
Manager to find these quickly.
WebSphere MQ also requires setup within the Library Manager. In addition to this, for certain
recording and virtualization methods, an extra piece of software needs to be installed on the queue
manager that you want to work with. As you will be recording traffic from WebSphere MQ in this
course, we will need to set this up as well.
1.2 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 the IBM WebSphere Application Server item on the left side.
You will now see a list of providers, for each supported version of the WebSphere
Application Server.
Page 5 of 127 © IBM Corporation 2001, 2013
- 10. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
2 Project setup
2.1 The initial screen
Once configuration of our system is complete, we are ready to launch Rational Integration Tester
and create a new project. Launching Rational Integration Tester will bring up the following screen:
If you are running Rational Integration Tester on your local computer, you will need to make sure
you have a license at this stage; cloud instances should already have a license installed for you.
Once licensing is sorted out, you have several options. From top to bottom:
New Project: allows you to create a project.
Clone Project: creates a copy of any Rational Integration Tester project.
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.
Open Link: follows a link taken from the Test Lab to navigate to the results of a test or test
suite.
Page 8 of 127 © IBM Corporation 2001, 2013
- 11. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
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.
2.2 Creating a new project
Creating a new project involves the following four stages:
1. Setting the project name and location
2. Connecting to external servers
3. Setting up user‐based permissions
4. Setting up change management integration
Only the first step is compulsory; the others are optional, with the settings available to edit later
from within the project. If you need to edit any of these settings after the project has been created,
you can do it through the Project Settings window (found in the Project menu of Rational
Integration Tester).
That said, filling out the server settings listed in the second stage of the project creation process
will normally be very useful, and we will be supplying that information for the examples used in
this course.
The first of these settings is for a results database, which we will be using during this training
course. The results database provides the ability to record and view historical test results. Without
this, you will only be able to view results from the current session. It also provides the ability to
record logging data from any stubs that you use. Scripts are provided with Rational Integration
Tester to help you set up and configure a results database, which can be an IBM DB2, MySQL, MS
SQL, or Oracle database. Once it is set up, the database can be shared across multiple users and
multiple projects.
The other server settings available are for Rational Test Control Panel and the Results Server
(legacy users only). Rational Test Control Panel provides the ability to manage any proxies and
agents used by the software; these capabilities can be used while recording and stubbing. The
Results Server setting is used to create links to the reports held on the server, which should also be
connected to your results database; this functionality is now provided by Rational Test Control
Panel, so the Results Server is no longer required, and will not be used in this project.
As we only have a single user for our example project, we will not configure user‐based
permissions for our project. It will be useful in other projects where it is necessary to restrict access
to a project to certain individuals, or to allow different access levels to the project for different
users. In particular, it will be helpful for projects that implement data masking. Permissions will
allow one user to set up masks over certain message fields, so that other users cannot view the
contents of those fields.
Finally, we can configure a connection to change management tools such as JIRA, HP Quality Center,
or any Open Services for Lifecycle Collaboration (OSLC) compliant change management system,
such as IBM Rational Team Concert™. This allows us to link directly into these tools, and to raise
defects directly from a test or test suite.
Page 9 of 127 © IBM Corporation 2001, 2013
- 15. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
3 Complex environments
3.1 Introduction
The Platform training modules used a simple web service to introduce you to the toolset. This set of
modules will use a more complex example, the Vacation Booking system, which has several
different subsystems. Your instructor may choose to use some or all of these sections during your
training course.
So before we can go any further, we need to know how this example system under test fits together.
There are three main sections to the system that we will be dealing with: a flight booking system, a
hotel booking system, and a flight administration system.
All three parts of the system are presented to the user through their web browser; the interface is
generated by a Tomcat web server, which connects to the relevant parts of the system as required.
In the background, the following software has been deployed:
Tomcat
IBM WebSphere Application Server
IBM WebSphere MQ
IBM DB2
In this module, you will see how the different parts of this system fit together. In the following
modules, you will see two different methods that can be used to build the model of the system
under test: using synchronization and recorded messages.
3.2 Managing flight bookings
The Vacation Booking system has three separate subsystems. The first of these lets users book a
flight on a fictional airline. Bookings can also be managed through the interface, allowing users to
find, update, and delete existing bookings.
The implementation for this is split into two parts: the set of services for making bookings, and the
set of services for managing bookings.
Page 13 of 127 © IBM Corporation 2001, 2013
- 16. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
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 that is used to hold booking
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.
3.3 Finding and booking hotels
Following a flight booking, a user might require a hotel in that destination. The HotelFinder web
service allows the user to look up a list of hotels that are available in a particular city between a
given pair of dates. Tomcat can then provide this list to the user. The HotelFinder web service is
hosted by Tomcat itself, rather than running on WebSphere Application Server.
Page 14 of 127 © IBM Corporation 2001, 2013
- 17. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
Vacation Booking
webapp
SOAP/HTTP
getHotels
bookHotel
3.4 Flight administration
On the day of a flight, users from the airline will need to check in passengers. The administration
services allow the user to first search through a list of flights, select a flight, and then select
particular booking on that flight. This is all done by Tomcat, directly accessing the DB2 database
used when creating and managing bookings.
When a passenger is checked in, the airline user will need to check their passport, and update
records accordingly. To do this once a booking has been selected, a message is posted to an MQ
queue in COBOL Copybook format. It is picked up by the flight confirmation service (running as its
own process), which then posts a reply back, also in Copybook format. Tomcat then uses the
information in this reply message to update the database.
Page 15 of 127 © IBM Corporation 2001, 2013
- 19. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
4 Synchronization
4.1 Introduction
The simplest option when building a model of the system under test is synchronisation. This
process analyzes the services and infrastructure provided by the system and replicates that within
the Architecture School. This will set up the logical and physical views, an environment, and any
message schemas used by the various services in the system.
In order to do this, Rational Integration Tester requires a valid synchronisation source to exist
within the system under test, so that it can request information on the system. Supported
synchronization sources include:
WSDL
UDDI (including WebSphere Service Registry and Repository)
WebSphere Message Broker
WebSphere Application Server
webMethods Integration Server
TIBCO BusinessWorks Project/Design Time Library
SAP System
Oracle SCA Domain
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 can be added to
the project if required.
After synchronisation, the system under test might 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 click 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
can click the Synchronise button, which will then update the Rational Integration Tester project
to resolve these differences.
Page 17 of 127 © IBM Corporation 2001, 2013
- 20. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
4.2 Exercise: Synchronizing with a WebSphere Application Server
1. You can start synchronization from either the Logical View or Synchronization View of the
Architecture School. The process is largely the same either way, but in this example, you
will use the Logical View, so switch to that view now.
2. Make sure that nothing is selected, so that the next item you create will go at the top level.
3. From the toolbar, add a new IBM WebSphere Application Server.
4. A dialog box will open to start the synchronization process. The first thing you will need to
do is to set up the connection details of the application server. To do this, click the New
button.
5. A second dialog box will open. Configure the server with the host localhost and the SOAP
Connector Port 8880. The security settings can be left blank. When you are done, click OK.
6. You will then return to the first dialog box. Now that you have entered details for an
application server, click Next.
7. On the next screen, select Create a New Component and click Next again.
Page 18 of 127 © IBM Corporation 2001, 2013
- 23. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
5 Building a system model from recorded events
5.1 Introduction
As you might have noticed, while Rational Integration Tester supports a number of synchronization
sources, not all of these will exist in every system. If a system does not have any of the
synchronization sources mentioned above, then there is nothing to refer to when building a model
of a system under test. For example, a WebSphere MQ‐based system might be able to provide
information on the available queues and topics, while being unable to provide any information on
the operations that access those resources, the dependencies between operations, or the message
schemas being used. In this case, we might be able to build a model of the system from recorded
data.
This is similar to the situation we see with the WebSphere Application Server and WebSphere MQ.
The application server can tell us of the existence of the queue manager, but it does not give us
enough information to be able to build up the operations that use that queue manager, or the
dependencies between those operations. We could build these by hand to fill in the missing gaps,
but instead we will use recorded messages to help us build the operations, leaving us with only a
few dependencies to add manually.
5.2 Recording MQ messages
Before you start doing this, we will take a quick look at how you will be recording messages on the
MQ transport. There are several different ways to record messages over this transport; each has
their own advantages and disadvantages. The choices are as follows:
Queue browsing
Proxy queues
Mirror queues
Dynamic 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 test 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, refer to the Rational Integration Tester Information Center. 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 similar to the
following diagram:
Page 21 of 127 © IBM Corporation 2001, 2013
- 24. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
The client application will communicate by way of 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 might 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 can choose to record just a given service if we have an operation definition (and so
know which queues to monitor), or we can record all queues within the queue manager by
recording the MQ transport.
5.3 Exercise: Setting up the transports
In the Vacation Booking system, you should now have a lot of information about the web services
included in the system. However, the WebSphere Application Server does not provide information
on the operations that run over MQ. This is because the applications installed on the application
server do not provide enough information themselves. As you will not be able to synchronize with
the server to get information about these, you will record the WebSphere MQ transport, and build
up the operations that way.
1. Before you can record the transport, you will need to select your recording method. Go to
the Physical View of Architecture School.
2. Find the MQ Queue Manager called QM_vbooking, and double‐click it to edit it.
3. A dialog box will open showing the physical settings for your queue manager. Switch to the
Recording tab.
4. Under Queue Recording, set the Recording Mode to Dynamic Mirror Queues. All other
settings here can be left at their defaults.
Page 22 of 127 © IBM Corporation 2001, 2013
- 26. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
4. You can select each of these, and view the associated message schemas on the right side of
the screen.
5.5 Exercise: Recording events from a transport
We will now capture events for the MQ Queue Manager transport.
1. Before we get started, we will need to initialize a few components of the system, such as the
GUI layer, to make sure that they are running. To do this, use the Start Tomcat shortcut on
your desktop.
2. Return to Rational Integration Tester, and go to the Logical View of Architecture School.
3. Make sure you are in the Local environment (as shown in the Rational Integration Tester
title bar).
4. Select the QM_vbooking infrastructure component. Note that there will be two: one
representing the transport as a simple JMS system, the other as a WebSphere MQ queue
manager. Choose the WebSphere MQ queue manager
5. Right‐click the QM_vbooking component, and select Record. The perspective will change to
the Recording Studio, and the QM_vbooking transport should be listed in the Event Monitors
panel.
6. Click the Start Recording button in the Events View toolbar to start recording events.
7. In a browser window, open the Vacation Booking home page. For a cloud image, this will be
listed in the favorites menu of your web browser; otherwise, ask your trainer.
Page 24 of 127 © IBM Corporation 2001, 2013
- 28. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
10. Return to Rational Integration Tester and you should see that four events have been
recorded in the Events View.
11. Click the first message in the Events View. You should then see the message details
displayed 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.
5.6 Exercise: Building operations from recorded events
Now that we have recorded some events, we can use these for a number of different purposes. The
first thing we will do is to complete the model of the system.
1. Take a look at your set of recorded messages, in particular the description fields. There
should be 12 messages, and the descriptions will list the queues that were used while
recording. This should include vbooking.booking, vbooking.payment.multinational,
vbooking.payment.global, vbooking.payment.worldwide, along with their respective reply
queues. If you are missing any of the different credit card queues, go back and record a
booking using that particular type of card.
2. Pause the recording by clicking the Pause button.
3. Select all 12 messages before clicking the Save button.
4. The Recorded Events wizard will open, 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 click Next.
Page 26 of 127 © IBM Corporation 2001, 2013
- 32. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
10. Now select a response message for MakeBooking, and follow the same procedure, using the
BookFlightResponse XSD.
11. We will need to go through the same process for the other operations in our system. Select
the two messages that are associated with the vbooking.payment.multinational queue,
give them an operation name of ProcessMultinational, and click 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, you will see
that it only includes a single text field, so we will not 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 you are done, the window should look like the
following screen capture:
Page 30 of 127 © IBM Corporation 2001, 2013
- 35. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
17. In the Logical View, you can now double‐click 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; it
should also show you the transport information used by that operation, including the names
of the queues that it uses.
5.7 Exercise: Completing the system model
You have now added a new group of operations to your model of the system under test. Each of
these should have their message exchange pattern configured, based on the schema information
you supplied while creating them. Each operation will also have a dependency on the WebSphere
MQ transport, as that is the transport used within their message exchange pattern. However, the
operations also have other dependencies. For example, the MakeBooking operation needs to use a
payment processor to complete a booking. Remember that adding a dependency does not indicate
an input/output relationship. In this example, when MakeBooking receives a booking that contains
information for a Global card, it will use the ProcessGlobal operation to check that the booking is
acceptable, and after it has received that response, it will then send back its own response.
1. Within the Logical View of Architecture School, we now need to add some extra
dependency information to give ourselves a complete system model. First, the MakeBooking
operation should have a dependency on each of the credit card processing operations. For
example, to add a dependency from MakeBooking to ProcessMultinational, select the Add
Dependency button from the toolbar, click the MakeBooking operation, and then click
the ProcessMultinational operation.
Page 33 of 127 © IBM Corporation 2001, 2013
- 36. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
2. Follow the same process to create dependencies from MakeBooking to ProcessWorldwide
and ProcessGlobal.
3. Next, each of the credit card processing operations should have a dependency on the
Vacation Booking database. Add a dependency from ProcessMultinational to the VBooking
XA Datasource component in the same way, and then do the same for ProcessGlobal and
ProcessWorldwide.
4. Note that dependencies are only shown for items you have selected. However, the entire
dependency tree will be seen using the default preferences. To see this, select MakeBooking;
you will then notice that a lot of dependencies will be displayed, making the diagram
difficult to read.
5. This is difficult to read, and will only get more difficult if we make the model of the system
more complex, so we will change the preference settings to show a single level of
dependencies. Go to Project > Preferences, and in the General panel, set Max
dependencies shown to 1, then click OK. The diagram should then become easier to read.
Page 34 of 127 © IBM Corporation 2001, 2013
- 38. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
6 Managing recorded messages
6.1 Introduction
You have already used the Recording Studio to record messages from the system under test, and
turn those into both tests and operations.
In this module, you will see a few other things that you can do with recorded messages. You will
start off by looking at how you can manage and filter the messages that you have recorded. You will
also see a couple of other things that you can do with recorded messages: creating requirements
and triggers.
6.2 Exercise: Recording events from an operation
Now that we have a model of the Vacation Booking system, we can choose to record events for
particular operations, rather than recording everything in the system. As we now have multiple
sources of events, we can also choose to filter events by source.
We will capture booking events again, but this time we will be recording events based on
operations rather than transports. We will see how we can filter these events. Later, we will see
how we can reuse these events to build other resources within Rational Integration Tester.
1. Return to the Recording Studio perspective and find the Event Monitors panel. This
should currently show that we are monitoring the QM_vbooking transport. We will stop
monitoring this for the moment, so select it and click the Delete Event Monitor button to
remove the event monitor.
2. We will also clear the events we recorded in the previous exercise. To do this, click the Clear
All Events button in the Events View toolbar.
3. Click the Add Event Monitor button; this will allow us to select an operation to record.
Choose the MakeBooking operation we created in the previous module.
Page 36 of 127 © IBM Corporation 2001, 2013
- 39. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
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 QM_vbooking 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. Switch the radio button at the top
of the dialog box from Direct Only to Indirect Only, and you should see the VBooking XA
DataSource component become available, while the other dependencies are hidden;
MakeBooking only has a dependency on VBooking XA DataSource 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 other operations had dependencies on the MakeBooking operation, we could select
those on the Parent References tab; as nothing depends on MakeBooking in our system, this
will not be necessary. Click OK to continue.
6. All four 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. Click the Start Recording button.
8. Switch to your web browser and submit another booking request, using a Multinational
credit card.
Page 37 of 127 © IBM Corporation 2001, 2013
- 40. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
9. Return to Rational Integration Tester, where you should see four 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 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
four events again.
12. Record two new bookings, again using the Global and Worldwide options. You should now
have 12 messages in total.
13. Again, you will 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 the Save icon on the Events View toolbar to open the
Recorded Events Wizard.
15. Select the requirements option on the first screen, and click 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. We will look at using data
sources later in the course, so for now, choose Store data as hard coded values, and click
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 click Next again.
18. You will then see a Header Transformation screen. Click Next through this screen.
19. On the Summary screen, you will be asked to give the requirement a name. Call it
exampleRequest. Clear the box labeled Open Resource After Finish, and click Finish to
create the new requirement.
20. Do the same for the corresponding reply message, calling it exampleReply.
Page 38 of 127 © IBM Corporation 2001, 2013
- 43. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
7 Creating tests for Vacation Booking
7.1 Introduction
In the Platform modules, you created two simple tests for the addNumbers service. In this module,
you will create tests for the Vacation Booking system. You will see some new methods of creating
tests: The first uses the Message Exchange Pattern (MEP), while the second makes use of templates.
7.2 The Tests using MEP wizard
Previously, you used the Test using MEP wizard. This helped you build one of your first tests by
providing the information required to send messages to the service, as well as providing the
appropriate message structures. All of this information was taken from the MEP that you had
created in the Logical View of Architecture School.
There is a second wizard that also uses the MEP, which can be used to help with creating tests
containing randomly‐generated data. In the previous example you saw, after the message
structures had been generated, the actual contents of each field were left blank. The Tests using
MEP wizard (note that it is labeled for a group of tests, rather than a single test) can be used to
generate such tests.
After the wizard has analyzed the message structure being used for the input message, you are
given the option to state how many times any optional or repeating elements should occur within
the input message. Previously, all elements only occurred once, or not at all if they were optional
and you had chosen to leave out all optional elements. Here, you have much more control over each
part of the message. Following that, you will be given the option of stating how the content of each
element should be generated. You can choose to leave it completely random, supply a constant
value, or have a value generated based on a regular expression that you supply. Note that any
random values will be fixed to those values after the generation of the test; they will not be
randomly generated with each execution of the test.
Depending on the type of data in the field, you might also be provided with other options. In the
training example, the most important of those options deals with fields that contain enumerated
values. You will see an example of this in the credit card type, which can hold the value of
Worldwide, Multinational, or Global. By default, the generation of data for this type is set to Iterate
Enum, which means that a test will be generated for each value of this field, giving you three
separate tests, each with their own data. If there were multiple enumerated fields, you would have
the option to determine the coverage of the generated tests over the enumerated fields. You could
either try to generate tests that covered each and every combination of any enumerated fields, or
just to generate tests that covered all values of each enumerated field at least once, without taking
combinations into account.
As with the example you saw earlier, where you saw the wizard create a single test, Rational
Integration Tester does not know what the values contained by the response message should be. As
with that example, the Tests using MEP wizard will also leave any fields in the response message
blank, to be edited by the user. Previously, you edited these fields. In this example, you will leave
the response message for now, and later overwrite the message with data taken from the live
system.
Page 41 of 127 © IBM Corporation 2001, 2013
- 44. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
7.3 Regular expressions
This module makes use of regular expressions during the use of the Tests using MEP wizard. This
course assumes some familiarity with regular expressions, but in case you do not use regular
expressions often, a table has been provided to explain the tokens that will be used in this module,
and future modules.
Token
Matches
^
The start of the string. No characters can occur before this point.
$
The end of the string. No characters can occur after this point
.
Any single character.
[ ]
Any single character contained within the brackets.
w
A single word character (a letter or number).
d
A single digit.
*
The preceding character 0 or more times. For example, d* means 0 or more digits.
+
The preceding character 1 or more times. For example, d+ means 1 or more digits.
{n}
The preceding character repeated n times. For example, d{3} means 3 digits.
{m,n}
The preceding character repeated, between m and n times. d{4,6} means a set of 4, 5,
or 6 digits.
There are more tokens available to use within the regular expressions used in Rational Integration
Tester, but this table will cover the majority of tokens used within this training course.
7.4 Exercise: Creating tests with the MEP wizard
1. In the Test Factory perspective, right‐click the Tests virtual folder under the MakeBooking
operation and select New > Tests using MEP. A wizard is launched that will help you create
multiple tests to validate all possibilities from the operation’s message exchange pattern
(MEP).
2. The first page of the wizard lets you control the structure of the request messages that will
be generated for each test. You can alter that structure by selecting how many occurrences
of each element should be included. As the message schema we are using does not allow for
any optional or repeating elements, every element should occur exactly once. This means
that we can leave all settings at their defaults for this example.
Page 42 of 127 © IBM Corporation 2001, 2013
- 49. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
14. Close this window.
7.5 Copying and linking requirements
So far, we have seen how we can create message data within a test by hand, or from random data.
In addition to this, we can also use previously created requirements to fill in message data.
In doing this, we can either copy the data that is held within the requirement, or link to the
requirement. Copying the message data will overwrite the information in the test action; it can then
be edited further as required, but any updates to the requirement will not be reflected inside the
test. Linking to the requirement will also overwrite the data in the test action, but in this case, the
test action will always use whatever data is held within the requirement. This means that updates
to the requirement will flow through to the test action as well.
To copy or link a requirement to a test action, simply drag the requirement onto the test action. You
will then be presented with the option to copy or link the requirement into the test action. Note that
this will copy or link all settings from the requirement, including transport settings. The only
exception will be any timeout and tolerance values held within the test action, which can be edited
separately.
Alternatively, you can open the test action, and go to the Config tab. Above the transport and
message settings on this tab, you will find two link
icons. These can be used to link the header
(including transport settings) and the message body. Using the two icons, we can choose what we
want to link, rather than linking everything at the same time. From these icons, you can also choose
to change a link to use a different requirement, or to unlink the message. Unlinking a message
Page 47 of 127 © IBM Corporation 2001, 2013
- 50. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
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.
7.6 Test templates
When creating new tests, similar sequences of actions can be used. Rather than recreating these
every time, Rational Integration Tester provides the option of test templates, which can be used to
store those common sequences for fast reuse when creating new tests. These new tests will then
have copies of the actions used within the template, which can be altered as required.
Test templates can be created in similar ways to tests. They can be created without any test actions,
in the same way an empty test can be created. It is also possible to create a template based on the
MEP of an operation. This will be similar to creating a single test from the MEP; the template will
contain messages based on the schemas used in the MEP, with each field left blank for the user to
fill in. After creating the template, it can then be edited in exactly the same way as a test, using the
same settings and test actions.
Once the template has been saved, tests can then be created based on the template. This will copy
all of the properties of the template into a brand new test. Note that this is simply a copy, and any
further updates to the template after that time will not automatically flow through to the tests
created from the template. However, if the template uses linked requirements, changes to the
requirements will still flow through to each test, as long as the requirements are not unlinked in
those individual tests.
7.7 Exercise: Creating a test from a template
1. Test templates, like tests, are created for operations. Return to the MakeBooking operation in
the Test Factory Tree.
2. Right‐click the operation and select New > Templates > Test Template using MEP. Call the
template basicTemplate.
3. Your test template will look much like the other tests you have created, though if you look at
the messages contained in the Send Request and Receive Reply steps, you will notice that
they are empty. Again, you will use requirements to fill in the message contents here. Drag
the exampleRequest requirement onto the Send Request step.
4. When asked, choose to Update this action with a copy of the requirement.
5. Carry out the same procedure again, dragging the exampleReply onto the Receive Reply
step.
6. The messages in the template should now be populated with data. Save and close the
template.
7. Let’s use the template to create a new test. Right‐click the MakeBooking operation, then
select New > Tests > Test From Template.
8. Within the dialog box that opens, select the basicTemplate, and give your new test a name,
such as exampleFromTemplate.
Page 48 of 127 © IBM Corporation 2001, 2013
- 52. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
8 Repairing tests
8.1 Introduction
The first tests that you created for the addNumbers web service were very simple. They passed if
the system was giving us the correct responses, which it was doing. However, this might not always
be the case. Obviously, some tests will fail due to the system not responding, or responding
incorrectly. In these cases, you might like to know some more detail; for example, which field or
fields were incorrect?
At other times, you might have generated tests that you would like to use as regression tests. In
these cases, you might just generate the request message, and use the reply message from the
system as the correct response. If you already have a reply message in your test, as you have in the
example tests that you generated from the MEP, then you might need to replace or update this
message. You might have come across this process in other tools. In some tools, you might know it
by the term “healing”; in others, including Rational Integration Tester, this process is called
repairing the test.
In this module, you will first see how to examine the output of your tests, and then go into more
detail by comparing the expected and received messages. You will then see how to repair a test step
containing an incorrect message. Finally, you will see how you can apply these changes to multiple
tests using a rule.
8.2 Exercise: Reviewing test results
You will now run your tests and review the results. These tests will not pass at first, so you will also
use the Message Differencing Window to get more information.
1. Switch to the Test Lab perspective.
2. Run the exampleFromTemplate test by right‐clicking on it and selecting Run from the context
menu, or select the test and click Run in Rational Integration Tester’s main toolbar. In
this case, the test should fail because the reservation number does not match what is
expected.
3. Click 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.
Page 50 of 127 © IBM Corporation 2001, 2013
- 57. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
that we did previously, but we would need to do the same thing for each of the other tests as
well. Instead, we will use the Rule Cache to apply repairs to multiple tests.
8.4 The Rule Cache
Every time that you have validated any part of a message so far, that validation has only applied to
that single message. Rational Integration Tester can also set up rules to apply validation settings
across multiple messages. For example, you might realize that you will not always get back the
same response for a particular field, no matter what message it appears in. In our system, an
example of this is the reservation number returned after a booking. In each test, it should always
appear in the form of A followed by 5 digits, as specified by the regular expression we used in the
previous exercise.
Because it does not matter what test this is in (we want the same regular expression used in all of
our tests), it would be easier to set this validation setting so that it is applied to all tests that use the
same message schema. This is exactly what a rule does for us.
The easiest way to create a rule is by choosing to add your repairs to the rule cache as you repair
your tests. This is what you will be doing in the following exercise. You can also choose to create
rules from the Config tab of a messaging action (right‐click and choose Rule Cache > Add to
Cache…). You can also create rules from the Rule Cache view of Architecture School, which
provides an overview of all rules within your current project. If you explore the Rule Cache, you will
also notice that rules can be set up for more than just validation; you can also specify rules for
providing values, filtering values, or storing values into variables.
Once a rule is being applied to a particular field within a schema, it should show up in both the test
action within the Test Factory, and within the Message Differencing Window. A rule will be
indicated by the star icon: . You might also want to disable a rule for a particular messaging
action by right‐clicking on the appropriate line of the message in the Config tab, and selecting Rule
Cache > Disable. If you do this, the rule icon will be modified to add a red line through it ( ) to
show that a rule is available, but that it has been switched off in this particular case to allow the
user to set their own method of dealing with that particular field.
8.5 Exercise: Creating validation rules
1. Run the paymentcardType = global test again. As predicted, it should fail due to the
reservation number.
2. Bring up the Message Differences window, and select the check box Add to Rule Cache.
3. Make sure that the reservation number field is selected, and click 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.
Page 55 of 127 © IBM Corporation 2001, 2013
- 59. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
9 Creating and running a stub
A stub can be used to simulate a system or process that is unavailable. In the example below, we
will create a stub from the request/reply events that were recorded earlier. This stub can then be
used to simulate the business process that is unavailable.
9.1 Exercise: Creating a stub from recorded events
1. Open the Recording Studio perspective and clear any previously recorded events from the
Events View.
2. In the list of Event Monitors, choose to record the MakeBooking operation.
3. Make sure that recording is currently switched on.
4. Go to the Test Lab perspective to run the paymentcardType = worldwide test, then return
to the Recording Studio.
5. Click MakeBooking in the Event Monitors to filter out any messages from other sources.
6. Select a request message and the corresponding reply message in the Events View.
7. Click the Save button. Select stubs on the first page of the wizard, and click Next.
8. On the second page of the wizard, we have the option of creating several different types of
stub. As this stub will be pretty simple, we will choose to use the Store data as hard coded
values option. Click Next once you have done this.
9. The next page of the wizard simply asks for verification that all events have been sorted by
the correct operation. As we have already filtered messages by the MakeBooking operation,
this should show two messages from that operation. If so, click Next.
10. On the following page, the messages have been grouped into transactions. As there is only a
single pair of messages for the moment, these should both be listed as a single transaction.
Click Next again.
11. Following this, you will see the Header Transformation page. This will remove information
from the message headers that normally will not be relevant to your stub, such as the
timestamp of the recorded messages. Leave all checkboxes ticked here, and click Next.
12. 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.
13. Click Finish to create the stub. Rational Integration Tester should then switch to the Test
Factory perspective.
14. We can now take a look at the stub we have created. In the Events 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.
Page 57 of 127 © IBM Corporation 2001, 2013
- 60. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
15. Below this, we can see the messages we recorded previously, in the Input and Output tabs.
16. By default, the stub will attempt to filter out anything that does not exactly match the default
message that we received. In those cases, it will not send a response message; instead it will
discard the request message. In this example, we would like to be less strict, and respond to
anything. To get started, switch to the Input tab, and take a look at the message body. You
will see that each text field has a small filter icon next to it:
17. We want to switch off any filtering that is checking for an exact field match. To switch off
filtering for the exact matches, select all of the fields within the message (you might need to
scroll down to do this). With everything selected, right‐click to bring up the context menu,
and then click Contents > Field Actions > Filter > Equality. This will toggle the equality
checks off, and the message body should then be shown without the filter icons, like the
following screen capture:
Page 58 of 127 © IBM Corporation 2001, 2013
- 61. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
18. 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.
19. Save your stub; it is now ready to run.
9.2 Exercise: Executing a stub from Rational Integration Tester
Now that you have created a simple stub and edited it, you can run that stub inside Rational
Integration Tester.
1. Before we start using our stub, we will switch off the service in WebSphere Application
Server, so we are certain that it is not processing any messages, but instead leaving them for
the stub. To do this, open up your web browser, and follow the link in your bookmarks to the
Websphere Integrated Solutions Console. When asked for login details, leave them blank,
and click the Log In button.
2. In the left pane select Applications>Application Types>WebSphere Enterprise
Applications.
3. The list of applications that we are using within WebSphere Application Server will then be
shown on the right side. Check the box for vbooking.booking.app ; this handles booking
requests for us.
4. Above the list of applications, there is a Stop button. You can now click this to stop the
booking application; note that this will take a moment. You should then see that the
application has stopped successfully.
Page 59 of 127 © IBM Corporation 2001, 2013
- 62. IBM RATIONAL INTEGRATION TESTER TESTING TRAINING GUIDE
5. Return to Rational Integration Tester, and switch to the Test Lab perspective.
6. You will still see your stub in the tree on the left of the screen. Run the stub, either by
double‐clicking on it, or by selecting it and clicking the Run button.
7. The stub will then be displayed in the Task Monitor. Some initial details will be shown
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 we will provide
something for it to work with. Return to your web browser, and make a new booking.
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 in your web browser, 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 should not make any difference what booking request we send to the stub; all messages
will receive the same response.
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 might
or might not be necessary, depending on what you intend to do with the stub. If all you require to
Page 60 of 127 © IBM Corporation 2001, 2013