Many testing teams struggle trying to relate
multiple transactions (HTTP/RMI/IIOP) and component
interactions with a single use case. Displaying
even a single webpage or a form within a client
application can result in many round trips between
the client and server, and server and backend
resource (message system or relation database).
The hardest part for the tester is post analysis
and correlation of the transactions and component
interactions. Even with a distributed tracing
solution such as JXInsight the automatic correlation
of traces spanning multiple JVM's might still
be too fine grain for the tester who is working
at the use case level.
Solution
JXInsight 4.0 delivers an innovative
solution to the problem that is rather simple (
as
are most good ideas) but extremely powerful
that allows the tester to inject a trace identifier
into the client, server or cluster before the
starting the use case and then reset the trace
identifier post the completion of the use case.
The trace injection inserts a new trace identifier
onto the trace stack for all future traces within
a server's JVM. The injection spans thread groups
and threads. It can be viewed somewhat like
a system trace root identifier but over time
dynamic.
Example
The use case selected for this article is the
Patient Lookup within the J2EE
Sample Application Medrec shipped with BEA WebLogic
Server. Starting from the Patient Lookup page
the user types in a string pattern for the patients
last name.
The user is then presented with a list of possible
patients. The correct patient is selected by
clicking on the last name hyperlink.
The list of visits associated with the selected
patient are displayed.
Tracing this with JXInsight provides the following
Traces table view within the Traces perspective
which is part of the Profile analysis mode.
From this we cannot easily determine that actual
use case though we can see the HTTP requests,
EJB invocations and Web Services calls.
Lets repeat the use case but this time we inject
a trace into the server via the JXInsight Console
or JXInsight Terminal. The injected trace is
called "patient.lookup".
The injection of a trace can be invoked
via JXInsight Terminal scripts or from the command
line.
$ injecttrace -set patient.lookup -host localhost
-port 1515
After the use case has been executed and the
injected trace removed we retrieve the snapshot
from the server again. This time all HTTP request,
EJB invocations and Web Services calls are grouped
under the injected trace identifier "patient.lookup".
The complete server request time for the use
case can now be determined much easier. A side
benefit is that the tester does not have to
export a snapshot for each use case executed
during a test session. Changing the injected
trace before and after each use case executed
will partition each use case within the profile
snapshot taken at the end of the test session.
Client-Side Injected Traces
Client-side injected traces will also be sent
across the wire allowing for the partitioning
of a particular client use case(s) on a server
handling multiple non-traced clients.
William Louth, JXInsight's Product Architect