You are on page 1of 16

Business-process-driven

gray-box SOA testing

&

Challenges are emerging in testing service-oriented architecture (SOA) systems.


Current testing is not sufficient to deal with the new requirements arising from several
SOA features such as composition, loose coupling, and code without a graphical user
interface. The most critical architecture information of an SOA solution is actually how
services are composed and interact with each other. This paper proposes a gray-box
testing approach, that is, an approach that involves having access to internal workings,
data structures, and algorithms when designing the test cases but tests at the user
Z. J. Li
level as a black box, that is, by applying inputs and observing outputs. This approach
H. F. Tan
leverages business processes and the underlying SOA layered architecture to better
H. H. Liu
test SOA solutions. A commonly used language to model business processes is BPEL
J. Zhu
(Business Process Execution Language), which is the focus of the approach described
N. M. Mitsumori
in this paper. Among the layered artifacts, the business process view represents the
global behavior of the SOA system and thus is a good candidate as supplemental
architectural information to the functional requirement or specification in test-case
design and generation. This approach has three key enablers: test-path exploration,
trace analysis, and regression test selection. BPELTester is an innovative tool that
implements this method. It has been piloted in several projects and the initial pilot
results are presented in this paper.

INTRODUCTION the tester inputs data and sees only the output from
Service-oriented architecture (SOA) provides a the test object. Current black-box testing at the
service ecosystem in which composite business- graphical user interface (GUI) level is not sufficient
centric services can be assembled on the fly as to deal with the new requirements arising from
requirements change. Testing of the new compo- several SOA features such as composition, loose
nents is similar to traditional application testing, but coupling, and GUI-less code.
testing the assembled processes requires new and
more extensive testing approaches.
ÓCopyright 2008 by International Business Machines Corporation. Copying in
printed form for private use is permitted without payment of royalty provided
Problem definition that (1) each reproduction is done without alteration and (2) the Journal
reference and IBM copyright notice are included on the first page. The title
Black-box testing treats the software as if one had no and abstract, but no other portions, of this paper may be copied or distributed
understanding of internal behavior. It tests the royalty free without further permission by computer-based and other
information-service systems. Permission to republish any other portion of the
functionality according to the requirements. Thus, paper must be obtained from the Editor. 0018-8670/08/$5.00 Ó 2008 IBM

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 457


Composition of coarse-grained services introduces changed, and those changes will affect the con-
test-coverage challenges. Test coverage is a well- sumer’s function. This is why loose coupling makes
accepted aspect of testing discipline. It directly regression test selection more important.
relates to the risk-management objectives of the
projects being tested. It is also the metric that Since many services are GUI-less, there is a need for
dictates the overall test activity plan. So how is test-case generation from non-GUI artifacts such as
coverage different in SOA? SOA coverage must WSDL (Web Services Description Language) and
consider how each element operates within a BPEL (Business Process Execution Language). [By
2

process, not just how an element operates in BPEL, WSDL, and XSD (XML Schema Definition) in
isolation. It is reported in Reference 1 that Theresa this paper, we are referring to services or functions
Lanowitz, lead analyst for application testing for created in these languages.] Such test cases have
Gartner, Inc., observed that traditional coverage advantages over GUI-specific test cases in that they
ratios become diluted when considering the process can persist through GUI changes and can be easily
as a whole. For example, if traditional coverage is automated.
set at 80 percent for each part of a three-part
process, the overall coverage equates to only about
Related work
50 percent (i.e., 80 percent 3 80 percent 3 80
In current SOA testing research and in the product
percent). This coverage level is more unacceptable
marketplace, a lot of work is focused on testing Web
in the SOA context because the composed process 3
services, although that is only a small piece of SOA.
will be used by many more users in a much more
In most Web-service testing research, the test data
unpredictable way compared with traditional com-
or test sequence is generated based on the interface
ponent-based software. Therefore, additional tech-
specifications. They belong to black-box testing.
niques are needed not only to improve the coverage
of all hidden elements, but also to raise the
assurance level by covering the end-to-end process Due to the important role of BPEL in service
itself. composition, BPEL testing has also become a focus
for research in recent years. One author of this paper
The constant change that occurs in a loose-coupling proposed a general test framework for BPEL unit
4
SOA environment can imperil system stability. testing in 2005, proposed a Java** test framework
5
Changes are driven by market pressures, customer for BPEL unit testing in 2006, and implemented a
6
demands, regulation, reorganization, and techno- test-generation algorithm that forms the base of the
logical evolution. In an SOA environment, a change test-path exploration function of the BPELTester,
which is introduced in this paper. The test-genera-
in one part of a business system is no longer an
tion algorithm in Reference 6 is only a preliminary
isolated alteration that has no impact on external
implementation, with a simple model, a simple
parties. One now has to determine if a change affects
searching algorithm, and the omission of some
anything else in the series of connections. To
advanced BPEL features.
mitigate the risk, there is a need to identify all test
cases that should be rerun in order to ensure that the
change does not have a negative impact on the From another perspective, due to the dynamics of
originally working functions (i.e., regression test SOA, testing that is based on static analysis is
selection) and to ensure that the test cases evolve insufficient to ensure the coverage of an SOA
7
with system changes. system. Canfora and Di Penta proposed the idea
that testing and runtime monitoring techniques
With loose coupling, people can develop and should be combined to improve the quality of an
maintain their own blocks independently without SOA system.
interfering with others’ blocks, but this indepen-
dence sits on the syntactical match, not a semantic Because SOA conforms to open standards, service
match. As long as a service does not change its interaction information can be captured in the
interface, the consumer will not notice an imple- middleware without modifying the applications
mentation change. However, there is a potential risk either before or after deployment and even when the
that the internal functional logic might have environment includes a mixture of programming

458 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


languages and operation platforms. This monitoring are introduced. These enhancements aim to provide
capability at the middleware layer makes it easy to a greater capability for test generation that can be
log the Web-service interactions as a trace. Also, applied to real, complex BPEL processes.
there are tools to capture and visualize the execution
8
of Web services. Web Services Navigator is Trace analysis maps Web-service invocation records
designed to help users understand the dynamic that are collected in a distributed environment to
behavior of a distributed SOA system by visualizing test paths inside BPEL processes. It validates these
the execution of Web-services-based applications. traces, provides insight into the business importance
However, there are no methods to correlate trans- and relevance of the test cases, and helps improve
action trace with business process. In this paper, we test coverage by introducing newly discovered
report a trace-analysis framework that can perform runtime process execution patterns.
the correlation.

9 Regression test selection identifies the impacted test


In the regression testing area, Liu et al. proposed a cases when Web-service implementations or busi-
method to select regression test cases based on the ness processes are changed. The impacted test cases
comparison of the old and new BPEL processes. Its can then be selected to be run or rerun in order to
limitation is that it cannot identify the new-
test the changed application.
structural tests (test cases associated with the new
process structure). To overcome this limitation, in
The left side of Figure 1 shows the SOA solution
this paper we propose a new regression test
development process and associated main artifacts.
selection method based on the direct comparison of
In the business-level specification, we have process
the two sets of test cases that are generated when
models, requirements, and functional design. In the
the test-path exploration function is used for both
IT-level (information-technology level) implemen-
the old BPEL process and for the new BPEL process.
Furthermore, a minimization algorithm is proposed tation, we have a realized SOA architecture, service
to select a minimum set of test cases that can cover implementations, BPEL process implementations,
all of the activities impacted by a process change. and other applications. Then the implementation
artifacts are deployed to the test environment for
system testing. After that, they are delivered to the
Brief summary of the new solution
production environment.
This paper proposes a gray-box testing approach
that leverages BPEL as the underlying SOA layered
architecture to better test SOA solutions by meeting The right side of Figure 1 shows a scenario of how
three challenges: ensuring proper coverage for our technique works. The test-related artifacts are
composition, ensuring proper regression testing for positioned according to the development layers to
loose-coupling SOA, and doing test generation for which they belong or correspond. For example,
GUI-less code. This approach has three key en- BPEL belongs to the IT level.
ablers: test-path exploration, trace analysis, and
regression test selection. Test-path exploration and trace analysis work in a
complementary way. Test cases group 1 is designed
Test-path exploration automatically finds the typical directly from requirements and represents tradi-
execution scenarios that correspond to end-to-end tional specification-based test cases. This group is
business transactions (and the critical test data) and already present in many projects. Test cases group 2
ensures the proper coverage of implemented Web is designed from BPEL processes and represents test
services and internal system integration scenarios. cases derived using the technique proposed here. By
These test scenarios can be used in both process unit running group 1 test cases, collecting traces,
testing and service and process integration testing, mapping them back to BPEL paths, and comparing
and they can be executed in various SOA test such paths to autogenerated test paths, we can
automation tools, including IBM WebSphere* Inte- identify the differences in test cases and improve the
gration Developer (WID) and IBM Rational* Tester coverage by combining the two groups of test cases.
2
for SOA Quality. In this paper, enhancements to the In addition to test traces, this kind of trace analysis
original model and to the path-searching algorithm also works for production traces.

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 459


Business-level specification

Business process Requirement Test Test cases group 1


model design design

Test cases group 2


Tools
IBM WebSphere Business Integration Modeler
IBM Rational Software Modeler

Build
IBM Rational RequisitePro*

IT-level implementation Test path Test


Revise
SOA architecture refinement test cases run

External Automated Manual


activities activities activities Path update
BPEL test paths Updated BPEL test paths

Service BPEL Application Web Test path Regression Test path


exploration test selection revision
Tools
IBM Rational Software Archtect Process update
IBM WebSphere Integration Developer BPEL Updated BPEL
Deploy

Test and production environment Trace


analysis
Automatic
verification
Packaged IBM WebSphere
application Application Servers

- Link to BPEL test paths


Legacy - Evaluate test coverage
application - Debug problems Transaction traces
- Assign test weight
Tools - Add new test paths
IBM Web Services Navigator

Figure 1
Gray-box SOA testing method

Regression test selection works in response to Web tween SOA system components. It is ideal to
service or business process changes. When business exercise all the possible runs of a program to detect
processes are updated, we need to identify affected hidden bugs in testing.
test paths. Based on this, test cases can be revised
more easily. We also need to remove obsolete test Test generation for both sequential and concurrent
10–12
paths and add new test paths. programs has a long research history. BPEL has
unique features in both syntax (e.g., flow with
The next section of this paper elaborates the test- activity synchronization, join condition) and se-
path exploration technique. The following sections mantics (e.g., multiple-choice workflow pattern,
discuss trace analysis, regression test selection, and dead path elimination) that need special treatment.
BPELTester implementation. We then conclude the In an earlier work, we implemented a graph-search-
6
paper and forecast future work. based approach to BPEL test-case generation. We
first transformed BPEL to BPEL flow graph (BFG),
TEST-PATH EXPLORATION which is an intermediary model extended from
Like other programs, a BPEL process contains control flow graph (CFG). Then we generated
different execution paths that represent different concurrent test paths based on BFG and generated
Web-service interactions (transaction patterns) be- test data for each path.

460 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


EventHandlers CompensationHandler BFGNamedElement
+name : String BFGLink
+status : ExecutiveStatus
+ID : Integer +linkStatus : Boolean = true
+type : String +transitionCondition : String
+nameMapping : String
children +links

<<enumeration>>
ScopeTree ActivityDomain BFGNode ExecuteStatus
father +scopeName : String +inputAction : String +Executed
BFGProcess
+outputAction : String +NotExecuted
+nodes
+internalAction : String +name : String +DPE
+Ready

CatchAllNode CatchNode BFGActivitiyNode BFGFlowNode


+faultName : String +isStartNode : Boolean
+faultVariable : String +isFinishNode : Boolean
+faultMessageType : String

CompensationNode BFGDisjoinedNode BFGUnitedNode


+scopeName : String

BFGForkNode BFGConditionNode BFGJoinNode BFGMergeNode


+joinCondition : String

Figure 2
BFG metamodel

BFG Assign data calculation information is kept in the


The full BFG is defined in a Unified Modeling internalAction attribute. The actions are used to
Language metamodel in Figure 2. Table 1 summa- perform symbolic execution when calculating test
rizes its major elements. data. BFGFlowNode represents structured BPEL
activities, including Flow, Switch, While, and Pick,
A BPEL process will be translated to an internal which introduce control flow structures. As intro-
representation of type BFGProcess, which is com- duced in Reference 6, Flow will be transformed to a
posed of nodes (type BFGNode) and links (type BFGCondition node and a set of BFGForkNode to
BFGLink). Each link has a linkStatus and a implement its multiple-choice workflow pattern.
transitionCondition attribute. The linkStatus is used Switch, While, and Pick will be transformed to a
to mark whether a link is on a DPE (dead path BFGCondition node.
elimination) path. The transitionCondition holds
various BPEL conditions (each switch case, while, The ScopeTree class is used to keep the nested BPEL
or link can have a condition). There are two types of scope structure and provides navigation between
BFG nodes: BFGActivityNode and BFGFlowNode. scopes to correlate BPEL fault handlers and com-
BFGActivityNode represents basic BPEL activities, pensation handlers to faults and to compensate for
including Invoke, Receive, Reply, and OnMessage, actions that may occur during normal processing.
which are instructions for Web-service interaction, All the BPEL Catch and CatchAll activities are
and Assign, Wait, and Terminate, which are internal attached under a related ScopeTree node. The
activities. The input message information is kept in behaviors inside the BPEL Catch and CatchAll and
the inputAction attribute of the BFGNode, and the compensationHandlers will be transformed to

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 461


Table 1 BFG elements

Type Description

BFGNamedElement Structure collecting common attributes, such as name, type, and identification

BFGProcess The top-level structure representing a BPEL process, composed of BFGLink and BFGNode

BFGLink Structure that connects BFGNode

BFGNode Structure collecting common node attributes. A set of actions record the data calculations
(assignments) in the node

BFGActivityNode Structure for basic BPEL activities

BFGFlowNode Structure for structured BPEL activities

BFGDisjointNode Structure for fork and switch activities

BFGUnitedNode Structure for join and merge activities

BFGForkNode Structure for pure concurrency

BFGConditionNode Structure for exclusive choice

BFGJoinNode Structure paring with BFGForkNode

BFGMergeNode Structure paring with BFGConditionNode

CompensateNode A special BPEL basic activity that must have a scopeName attribute

ScopeTree Structure for BPEL scope hierarchy

ActivityDomain Structure for organizing fault-handling logic

CatchNode Structure for Catch activity inside a faultHandler

CatchAllNode Structure for CatchAll activity inside a faultHandler

CompensationHandler CompensationHandler

EventHandlers EventHandlers

BFGNode and BFGLink elements in exactly the same algorithm must be able to support this requirement;
way as described in the previous paragraph. BFG otherwise the test generation will get into infinite
CatchNode, CatchAllNode, and CompensationHan- loops.
dler all have a startNode and an endNode attribute
to point to the contained behaviors. Another complexity of the BPEL fault-handling logic
exists in the fact that after a fault is thrown, all other
Based on this model, BPEL fault-handling logic can activities inside the scope need to be terminated.
be supported. During the transformation of BPEL to BPEL can express concurrent behaviors, so the exact
BFG for an Invoke activity, if it can throw a fault, the execution path is indeterministic when a fault
algorithm will search the ScopeTree, find the Catch occurs. Suppose we have two threads: When one
or CatchAll that captures the fault, and make a thread throws a fault, the other thread may complete
connection from the Invoke activity to the matched one, two, or more activities depending on runtime
Catch or CatchAll node. Here we must handle the scheduling and the speed of peer services. It is
situation in which a fault is thrown inside a inefficient to enumerate all these varieties. Our
faultHandler. The BPEL specification says that such approach is to find the longest possible execution
a fault should not be captured by the scope to which path. To achieve this, the path-searching algorithm
the faultHandler belongs (in order to avoid loops in starts from the fault point and tracks down the path
the fault-handling logic). The fault-catch matching that is followed when the Invoke gets a normal

462 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


(LoanRequest.amount,0) Receive Loan Request

LoanRequest.amount<10000

(AssessResult.risk,'high') Invoke Assessor LoanRequest.amount> =10000

AssessResult.risk = 'low' AssessResult.risk! = 'low'

Assign Approval Sequence

Assign Init Assignment: LoanResponse.result:='approve failed',


FaultCount.count:= 0

While While condition: LoanResponse.result='approve failed'


&& FaultCount.count<2

Invoke Approver (LoanResponse.result,'success')

Reply Loan

Structured
Links activity
Links with transition condition
Assign activity
Sequence connection
Test path Web service activity

Figure 3
Test path, test-path feasibility, and test data

response. All the nodes that are in the fault are actually feasible. A test path is feasible if there
propagation path (also in the fault scope) will be exists at least one set of test data that satisfies all the
terminated; the other nodes not affected by the fault conditions (described as logic expressions) in this
will be executed. This is implemented as a special path. We can use satisfiability and constraint solving
14,15
kind of DPE. tools to solve the Boolean expressions and the
13
formulas of inequalities and equalities derived from
Using the Eclipse Modeling Framework (EMF), the each test path. If no solution is found, the path is
BFG model can be transformed to Java classes that infeasible and filtered; otherwise the
provide application programming interfaces to
path is feasible, and a solution is also at hand.
create, modify, and store BFG models transformed
Typically, the data constraints and the solution
from BPEL processes. During the transformation,
cover only part of the required data, composed of
data logic must also be processed. BPEL variables
some fields of an input message. The rest of the
are filled in a variable table with their possible value
input message fields can be filled manually or by
domains. In addition, WSDL and XML Schema
Definition (XSD) information referenced by the using automatic data generation tools.
BPEL process should also be parsed to obtain the
Web-service definitions (operations, messages, and Figure 3 gives an example BPEL process and a test
data types). path with test data. The arrows pointing to BPEL
activities show process input locations where some
Test-path feasibility and test-data generation test data has been generated and listed in a format
A test path consists of activities that start from the similar to (LoanRequest.amount,0). For this exam-
process entrance (typically a Receive activity) and ple, we can also tell that the while loop must be
move forward until a process exit (typically a executed (i.e., cannot be skipped), because its
Reply), but not all the test paths identified as such condition is definitely to hold after the Assign Init

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 463


activity. In other words, any test path that skips the  All-path coverage—Enumerate all possible execu-
While loop is infeasible. tion paths. However, if a process contains a while
structure, each repetition will produce a new
Optimized test-path-searching algorithm execution path, and unlimited repetition will
The original test-path-searching algorithm in Refer- produce infinite execution paths. In order for the
ence 6 iterates two steps: find a test path and solve test-generation algorithm to complete in a rea-
the path constraints. In this way, it exercises all sonably short time, we chose to set an upper limit
possible test paths (both feasible and infeasible). It on the repetition number for each while structure
does not leverage any feasibility information that via user configuration. So a more precise name
has been obtained from the earlier test paths. An would be limited all-path coverage.
improvement here can be explained with an  Branch coverage—Try to cover each branch at
example. Suppose test path 1 is infeasible, and it can least once. BPEL branches include: switch(case/
be determined that it has become infeasible at the otherwise), pick(onMessage/onAlarm), invoke
point Node1, which is a BFGCondition node where (normal/fault), while(enter/skip), link(true/false).
the partial constraint at this point is already (Depending on the data condition, not all the
unsatisfiable. With this knowledge, we no longer branches could be covered.)
need to explore the other branches of Node1. In this
spirit, a branch-cut mechanism is implemented as After test generation, there are other goals that can
an improvement to the original algorithm. be achieved by selecting (automatically) a subset of
test paths from all the paths generated:
The key data structure of this algorithm is a branch
tree. It is dynamically constructed along with the  Branch coverage—This makes sense only when
path searching. Whenever a BFGCondition node is all-path coverage is selected before test genera-
encountered, N children tree nodes are added to the tion.
current tree node that the current test path contains,  Normal coverage—All test paths that contain no
where N is the number of branches of the faults.
BFGCondition node. Note that the path-searching  WS fault coverage—All test paths that contain a
algorithm is a depth-first searching one, so the Web-service fault (due either to a fault response to
branch tree will be constructed in a similar way. It an Invoke activity or a Throw activity).
can be seen that the branch tree is an exact tree  Service coverage—A minimal set of test paths that
representation of all test paths found so far: A path can cover all services.
from the root to each leaf node is a complete or  Customized operation coverage—This goal is
incomplete test path. measured in terms of Web service operations.
Users can select a set of Web-service operations
Initially, all the branch nodes are in ‘‘Unknown’’ and the tool will automatically select the test paths
status. Whenever a complete test path is found and that can cover any or all of the chosen operations;
the feasibility status is determined, the branch tree is the tool can also select a minimal set of test paths
updated. If the test path is feasible, all the tree nodes that can cover all the chosen operations.
in the path are set to ‘‘Feasible’’ status. If the test
path is infeasible, the path constraint is backtracked We also provide exact coverage rate for the
until a ‘‘Feasible’’ node is encountered or the following coverage goals:
constraint becomes satisfiable for the current node
Branch coverage, covRate ¼ (#branch covered)/(#all
or the root node is encountered. Then the node
branches).
preceding the current node along the backtracking
Service coverage, covRate ¼ (#service covered)/(#all
path will be the cut point. All the test paths under
services).
this node no longer need to be explored.
Operation coverage, covRate ¼ (#operation cov-
This branch-cut algorithm improves the test-gener- ered)/(#all operations).
ation performance significantly with very little WS fault coverage, covRate ¼ (#fault covered)/(#all
overhead. faults).

Test coverage For each category, all the uncovered items are also
The following two coverage goals can be selected listed as references for users to design further test
before test generation. cases.

464 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


This flexible coverage capability is important to finds a path to link all those leaves together to form
ensure sufficient SOA business-process or service- a path.
interaction coverage and at the same time allows
users to do customization according to their specific In the following sections, we explain the imple-
needs and constraints. mentation details of the BPEL-to-forest model
translation and the correlator.
TRACE ANALYSIS
Trace analysis takes traces collected in a testing or BPEL-to-forest-model translator
production environment, identifies the transactions, The forest model separates the scopes, activities,
and maps each transaction to the test paths of the and links, and uses a parent-child relationship to
related BPEL processes. It can be used to build the describe the nested control flow structure in the
linkage between test cases (as well as normal BPEL process. It can be defined as: forest ¼ hT, pi,
production uses) and BPEL process execution paths. where T is the set of the trees related to the process.
Based on this linkage, the following functions can be Each tree represents the behavior inside a specific
provided: scope; p is the tree representation of all the scopes
defined in the process.
1. Runtime validation using the implementation
information: A process execution path gives Each node of the scope tree has links to several
information about how the services are com- behavior trees: normal activity tree, eventHandlers
posed to provide another service, and a transac- tree, faultHandler tree, and compensationHandler
tion trace gives information about how the tree if they exist in the process definition.
services interact with message exchanges. Thus
we can validate the correctness of a business Figure 4 shows how the BPEL control flow structure
process path execution by combining them. is represented in a tree model. Each activity in a
2. Test-path coverage analysis for a set of test cases structured activity is a child node of its immediately
in terms of the BPEL process structure coverage. enclosing structured activity. The links information
3. Finding all test cases that need to be updated with in a flow is represented in an Adjacency Matrix
the system evolution: Changes that can affect a where the rows and columns are activities, and the
test path will also affect the related test cases. link information is stored in the intersection of its
4. Identifying the real usage profile of a business source and target activity.
process in production: Traces will reveal the real
executed paths and their occurrence frequencies. The translator converts a BPEL process definition to
This information is useful to find uncovered a forest model by traveling all the elements. The
paths for testing by comparing it with the testing translation rules are as follows:
profile and to prioritize test cases for the next
rounds of testing based on the occurrence 1. One activity is translated to a behavior tree,
frequencies of the related test paths. which is a child of its immediately enclosing
activity.
The transaction trace is translated to an intermedi- 2. One scope is translated to a scope behavior tree
ary model that is independent of any transaction like other types of activity, and it is also
trace format. It is composed of a set of service translated to a scope tree, which is the child of its
invocation events. Each event has three parts: port, immediately enclosing scope.
operation name, and the direction of the message. 3. Various handlers are translated to appropriate
The BPEL process is translated into a forest model (a behavior trees.
set of trees in which there is a scope tree
representing the nested BPEL scopes and pointing to Correlator
many other trees of the behaviors inside the scopes). This component finds execution paths of the BPEL
It uses a tree structure to keep the control flow processes for a specific transaction. The transaction
information, where activities related to service trace is an ordered set of service invocation events.
invocations appear as leaves in the model. The The correlator is a finite-state-machine (FSM)
correlator travels the forest model to map each event generator. The states of the FSM are called match
of a transaction to one leaf in the forest and then points. Each match point includes a source events

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 465


A Sequence AND Split Flow

Sequence B A B C Flow A (. . .) B A ... C

C AND Join

XOR Split Switch While

Switch or pick A (. . .) B A ... B While A A

XOR Join Loop

Figure 4
Mapping from the BPEL structure to the tree model

set (a set of the unmatched events of the transac- of the message of the events. Table 2 shows the
tion), a matched leaves set (a set of matched leaves mapping rules. For example, the first rule states:
that have been mapped to the events of the When a message belongs to a service provided by
transaction), and a target leaves set (a set of leaves the process (service owner), and the direction of the
in the forest that are possible to match the remaining message is from partner to process (message
unmatched events in the transaction). Each transi- direction), the event will correspond to a Receive or
tion is a transfer from the current match point to OnMessage BPEL activity.
another match point by matching the next un-
matched event in the source events set to one of the For each found mapping, a new state is generated.
leaves in the target leaves set. In the initial state, the For the new state, the leaf is added to the matched
matched leaves set is empty, the target leaves set leaves set, the events are removed from the source
includes all the leaf nodes, and the source events set events set, and all impossible leaves in the target
includes all the events of the transaction. leaves set are removed. Impossible leaves include
the following:
Beginning at the initial state, all the transitions and
states are constructed until all the final states are  Leaves that are in the switch or pick branches that
found. For each state, we match the first one or two are not in the path.
events in the source events set to all the possible  Leaves that are in the dead path.
leaves in the target leaves set according to the  Leaves that are in the tree of the left siblings of the
service port, the operation name, and the direction children of the matched sequence.

Table 2 Rules for mapping trace events to BPEL activity

Service owner Message direction Operation type BPEL activity

Process partner ! process Any Receive or OnMessage

Process process ! partner 2-way Reply

Partner process ! partner 2-way Invoke, Catch

partner ! process

Partner process ! partner 1-way Invoke

466 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


If the source events set is empty and there are no 3. Obsolete paths—Only valid for the old process;
leaves in the target leaves set, a final state is reached representing old test paths that do not exist for
and one path is found. the new process.
4. New-structural paths—Only valid for the new
To form a path from a set of leaves, the correlator process; representing new test paths having no
travels the forest model to allocate all the ancestors correspondence in the old process.
of each identified leaf. Those ancestors and leaves
are kept in a set named visited set. We travel the Test selection based on test paths comparison
BPEL process definition and identify whether the After a business process is changed, new test paths
current node is in the visited set: if yes, the node is can be generated using test-path exploration. Use M
kept; otherwise the node is deleted. All kept nodes for the modified paths in the old path set, M 0 for the
make the path for the current transaction. modified paths in the new path set, R for the
reusable paths, D for the obsolete paths, N for the
REGRESSION TEST SELECTION new-structural paths, P for the old path set, and P 0
The objective of business process regression test for the new path set. It is obvious that the following
selection is to identify the impact of business are true: P ¼ R þ M þ D and P 0 ¼ R þ M 0 þ N.
process changes on test cases and then take proper
It is clear that by exactly comparing the paths in P
test-case update actions accordingly and determine
and P 0 , R could be obtained, which exists both in P
the subset of test cases to run or rerun.
and P 0 . Test paths in M and M 0 have the same
9 decision points and branches, so by comparing the
Liu et al. proposed a method to select regression
decision points and branches, we can obtain M and
test cases based on the comparison of the old and
M 0 , and then D and N can also be easily identified.
new BPEL processes. The advantage of this method
is that only the relationship between the existing test Test-selection minimization algorithm
cases of the old process and the BPEL activities In regression testing, the modified and new-struc-
should be known in advance, and no assumption of tural test paths should be rerun for the new process.
automatic test generation capability is made. How- Sometimes, instead of rerunning all of them, one
ever, it cannot identify the new structural cases, may want to further select a subset of these test
which need to be designed in one way or another. paths that has a lower level of test coverage,
To overcome this limitation, in this paper we covering all the impacted activities by the changes.
propose a new regression test selection method For this purpose, a test-selection minimization
based on the direct comparison of the two sets of algorithm is implemented.
test cases that are generated when the test-path
exploration function is used for both the old BPEL First, the impacted activities in the new process
process and for the new BPEL process. Furthermore, should be identified. For a nonconditional activity, if
a minimization algorithm is proposed to select a it is added into the new process, modified, or deleted
minimal set of test cases that can cover all activities from the old process, the added activity, modified
impacted by the process changes. These have been activity, and previous activity of the deleted activity
implemented in the BPELTester tool. in the new process are impacted activities. For a
conditional activity, Table 3 is used to identify the
Test-path classification impacted activities (not including the changed
We classify the test paths for the original process activity itself). In this table, the change actions
and the new process into four categories: include addition, modification, and deletion.

Let xi be the existence indicator of test path i. Let xi ¼


1. Reusable paths—Not impacted by the process
1 indicate that test path i is selected, and xi ¼ 0
changes, representing test paths that are common
indicate the opposite. The expression CA(xi ¼ 1)
to the old and new processes.
represents the activities on test path i, and CA(xi ¼
2. Modified paths—Impacted in the sense that
0) ¼ U. IA represents all the impacted activities in
conditional branches on the test paths are the
the new process. Then the constraint of the
same but activity attributes or nonconditional
optimization problem can be expressed by
activities are somehow changed, representing old
and new test paths that have minor differences. CAðxi Þ [ CAðx2 Þ [    [ CAðxn Þ  IA: ð1Þ

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 467


Table 3 Impacted activity table process definition or the service is changed,
BPELTester can identify the changed parts and the
impacts to test cases.
Activity type Impacted activity

Case Otherwise Tool architecture


Figure 5 shows the tool architecture. There are three
Otherwise none
layers: user interface (UI), model, and, at the back
onMessage none end, algorithm implementation.
onAlarm none
The UI layer provides functions to import the
Catch CatchAll required BPEL, WSDL, XSD, and trace files, to
CatchAll none visualize the BPEL process, to display all paths and
their details, and to show the delta of two BPEL
Link other links that have the same source
processes and the impact to the test paths when a
activity with this link
process is changed. The UI details are shown in
Figure 6.
Further, taking into consideration the possibility
that test paths could have different priorities we can The model layer includes two common models
use the objective function (among others) that are shared by the three
Fðx1 ; x2 ; . . . ; xn Þ ¼ f ðw1 Þx1 þ f ðw2 Þx2 þ    technical pieces. One is the BPEL model and the
þ f ðwn Þxn ð2Þ other is the test-path model. In our tool implemen-
tation, the Eclipse model generator is used to
wherein wi represents the priority of test path i, and generate a hierarchy of Java classes from the XSD
f(wi) is a monotonically decreasing function of wi. A specification of Web Services BPEL (WS-BPEL).
simple function can be f(wi) ¼ 1/wi. These classes represent the abstract syntax of the
language and parse the BPEL program to a set of
With the above definitions, it is obvious that the instances of those classes.
test-selection minimization problem becomes an
optimization problem, with Equation 1 as the
There are three back-end algorithm implementation
objective function and Equation 2 as the constraint.
modules. Test path exploration and trace analysis
In the BPELTester implementation, for simplicity we
transform the BPEL model to the required interme-
set all wi to 1 (meaning that all the test paths have
diary model and follow the described approaches to
the same priority). In this case, Equation 2 becomes
generate test paths. Regression test selection ana-
Fðx1 ; x2 ; . . . ; xn Þ ¼ x1 þ x2 þ    þ xn : lyzes the two BPEL models to obtain the delta and
compares the two sets of test-path models to classify
In general, the optimization problem is NP-hard.
BPELTester uses a dynamic programming algorithm them into the four categories enumerated in the
to find a solution. section ‘‘Test-path classification.’’

BPELTESTER IMPLEMENTATION TOOL Graphical interface


The proposed approach for SOA testing has been The BPELTester graphical interface offers eight
implemented in an Eclipse-based tool named views. The package explorer view lists all the
BPELTester. With a BPEL process and related created projects and their files. The process editor
artifacts (e.g., WSDL and XSD) as input, this tool can view visualizes the process and highlights the
generate all the execution paths with the test-path selected path and the delta between the old and new
exploration function. On the other hand, with test changed process in regression test selection. There is
cases (directly designed from business require- a path outline view that lists all paths for the process
ments) run and traces logged, or traces collected displayed in the process graph view. When users
from real production environments, BPELTester can select a path in the outline view, three views (path
analyze the traces and map the contained transac- attribute, branch, and coverage) show the detail
tions to the execution paths of the business process information of this path. The message view shows
with the trace analysis function. When the business the message content of the selected BPEL activity.

468 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


User interface Model Alogrithm implementation

Test-path exploration
Package explorer Selected WID BFG
artifacts Transform Generate
New views

Path attribute BPEL/WSDL/XSD

Branch
Trace Trace analysis
Coverage Forest
Transform Correlate

Message
Test paths Trace model
Parse
Path comparison

Regression BPEL changes Regression test selection

Compare BPEL/WSDL Compare paths


Path outline
Path changes
Process editor
Classify test cases

Figure 5
BPELTester architecture

Finally, the regression view shows the result of the found by exhaustive searching. However, these are
test-path classification after the process is changed. mostly small processes whose branch number is less
than 30. For big processes whose branch number
PRELIMINARY EXPERIMENTAL RESULTS exceeds 50, the chance is that a significant portion of
BPELTester has been applied in BPEL processes of the test paths will be infeasible. This fact is
varying complexity measured roughly by the total illustrated by process 12, which has 1301 paths in
number of activities and branches. These processes total, but only 205 feasible paths. We need to
are from various industry projects. Here we take 12 perform more experiments to identify the charac-
processes whose activity numbers are smaller than teristics of big processes. Also, as the test-generation
100 and, in Figure 7, show their complexity and the time is linear to the number of test paths searched,
test-path distribution in different categories. Four this tells us that a more efficient generation
categories are listed and compared: all paths, algorithm is needed to avoid the performance
feasible paths, branch coverage paths, and service problem for big processes. In fact, we tried a BPEL
coverage paths. Branch coverage paths constitute a process with more than 100,000 paths but only a
subset of feasible paths, which constitute a subset of tiny portion of them were feasible. With the original
6
all paths. Service coverage paths are selected from algorithm, test generation for this process reported
feasible paths. that it was out of memory before completion. Via the
branch-cut algorithm, the infeasible paths can be
Some processes use advanced BPEL features of fault removed as early as possible during the searching
handling, and the implemented test-generation procedure, and it requires only several minutes to
algorithm has proved that it supports these features complete.
very successfully. Figure 7 shows the following
points: It is a clear fact that the branch coverage path
number is very small for all the processes, including
For most processes (9 out of a total of 12), feasible the complex ones. These paths are typically the
paths account for a large portion of all paths that are longest ones in the process. We think that branch

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 469


Figure 6
BPELTester user interface

coverage is not adequate for business-process seconds (less than 5 minutes) on a desktop PC with
testing as it cannot check the interactions among a an Intel Pentium** processor running at 2.79 GHz
lot of upstream and downstream branches. Howev- with 1.98 GB of memory. However, we cannot make
er, if the user wants to achieve only the branch any deterministic statement on the relationship
coverage, BPELTester can help filter out a minimal between test-generation time and process complex-
number of test paths for the branch coverage goal. It ity. Among the many factors are: activity number,
is a similar case for service coverage. branch number, branching structure, condition
number and complexity, and data calculation
Test-generation time is another important metric to number and complexity. More experiments are
evaluate a test-generation tool. Based on the needed to establish a clear relationship.
preliminary result collected from more than 10 BPEL
processes whose activity and branch numbers were Transformation to execution formats
all under 100 (the upper bound was 88 for activities The resulting test paths can be mapped to three
and 73 for branches), the time maximum is 266.844 kinds of test cases.

470 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008


1. BPEL process unit test cases—The goal is to test a 100
single process in isolation from its dependent
services. This type is supported in the WID 80
integration test client now and can be categorized

Path percentage
as ‘‘service component testing.’’ 60
2. Service integration and composition testing—The
goal is to test the service composition capability 40
based on business scenarios. This type is now
supported in the IBM Rational Tester for SOA
20
Quality and can be categorized as ‘‘service
functional testing.’’
0
3. Business process end-to-end testing—The goal is Process 1 2 3 4 5 6 7 8 9 10 11 12
to test the end-to-end business process. This tests
the business processes and their dependent Activities 22 16 15 51 18 32 33 41 53 88 32 78
services. It is preferred that internal interactions
Branches 4 12 8 8 6 19 20 34 28 50 54 73
are checked following a gray-box testing style.
This type can be done from the GUI level or at the Service 1 1 1 2 1 2 1 2 2 3 1 2

service-invocation level, as supported by the IBM Branch 2 3 2 2 1 7 4 6 4 3 5 13


Rational Functional Tester. Feasible 2 5 4 5 2 12 12 17 10 264 481 205
All 3 6 4 5 6 17 29 29 46 312 490 1301
We have implemented transformation types 1 and 3,
Service coverage paths
and transformation is ongoing for type 2. Branch coverage paths
Feasible paths
All paths
CONCLUSIONS AND FUTURE WORK
As more enterprises are implementing SOA, some Figure 7
challenges of testing SOA systems are emerging. Test-path distribution in categories
Current black-box GUI-level testing is not sufficient
to deal with the new requirements arising from
several SOA features. This paper proposed a gray- ness-level process models (e.g., models supported
16
box testing approach that leverages BPEL business in IBM WebSphere Business Modeler ) to gener-
processes and the underlying SOA-layered architec- ate business-level test cases, and this has been put
ture to better test SOA solutions. This approach has into our research plan.
three key enablers: test-path exploration, trace  The trace analysis should also go beyond the
analysis, and regression test selection. analysis of BPEL execution traces to end-to-end
business-transaction tracking and generate test
These technologies have been implemented in IBM cases at various levels. This is part of our ongoing
BPELTester. Initial experimental results have vali- research, as is the regression test-selection tech-
dated our observations in SOA testing and also raise nique.
the following new requirements:

 IBM BPEL extensions, like Java snippets, need to


*Trademark, service mark, or registered trademark of
be handled in order to improve the preciseness of International Business Machines Corporation in the United
the generated test paths. IBM BPEL allows one to States, other countries, or both.
embed any Java program snippet that can describe **Trademark, service mark, or registered trademark of Sun
complex control logic and data manipulations. A Microsystems, Inc., or Intel Corporation in the United States,
test-generation algorithm should be able to pro- other countries, or both.

cess BPEL and Java logic in an integrated manner.


 In addition to BPEL, other SOA architecture
information should be leveraged so that a broader
CITED REFERENCES
scope of SOA behavior can be tested. There is a 1. Solstice Software, Inc.,‘‘Assuring Quality Business Pro-
suggestion that we apply the technique to busi- cesses through SOA Testing,’’ White Paper, http://www.

IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008 LI ET AL. 471


spectrum-systems.com/white_papers/wp_assuring_ interests include various aspects of software engineering,
quality_solstice.pdf. automation of test generation, and Internet protocol testing.
2. Rational Tester for SOA Quality, IBM Corporation, http://
Hua Fang Tan
www-306.ibm.com/software/awdtools/tester/soa/index.
IBM Research Division, IBM China Research Laboratory, 2F,
html.
Diamond Building, ZGC Software Park, Haidian District,
3. J. Offutt and W. Xu, ‘‘Generating Test Cases for Web Beijing, P.R.C. 100094 (tanhuaf@cn.ibm.com). Dr. Tan holds
Services Using Data Perturbation,’’ ACM SIGSOFT Soft- a B.S. degree in computer science from the Beijing Institute of
ware Engineering Notes 29, No. 5, 1–10 (2004). Technology, China, and a Ph.D. degree in distributed
4. Z. J. Li, W. Sun, Z. B. Jiang, and X. Zhang, ‘‘BPEL4WS computing from the Institute of Computing Technology, China
Unit Resting: Framework and Implementation,’’ Proceed- Academy of Science. She joined the IBM Research Division in
ings of the IEEE International Conference on Web Services, 2005 and has worked on applying runtime trace to support
Orlando, FL, 2005, pp. 103–110. and enhance SOA testing. Her interests include runtime
monitoring, dynamical analysis, and selective regression
5. Z. J. Li and W. Sun, ‘‘BPEL-Unit: JUnit for BPEL testing.
Processes,’’ Proceedings of the 4th International Confer-
ence on Service Oriented Computing, Chicago, 2006, pp. He Hui Liu
415–426. IBM Research Division, IBM China Research Laboratory, 2F,
6. Y. Yuan, Z. J. Li, and W. Sun, ‘‘A Graph-Search Based Diamond Building, ZGC Software Park, Haidian District,
Approach to BPEL4WS Test Generation,’’ Proceedings of Beijing, P.R.C. 100094 (hehuiliu@cn.ibm.com). Mr. Liu holds
the International Conference on Software Engineering B.S and M.S degrees in computer science from Xidian
Advances, Tahiti, French Polynesia, 2006, pp. 14–23. University. He joined the IBM Research Division in 2006 and
has been working on SOA testing research.
7. G. Canfora and M. Di Penta, ‘‘Testing Services and
Service-centric Systems: Challenges and Opportunities,’’ Jun Zhu
IT Professional 8, No. 2, 10–17 (2006). IBM Research Division, IBM China Research Laboratory, 2F,
8. W. De Pauw, M. Lei, E. Pring, L. Villard, M. Arnold, and Diamond Building, ZGC Software Park, Haidian District,
J. F. Morar, ‘‘Web Services Navigator: Visualizing the Beijing, P.R.C. 100094 (zhujun@cn.ibm.com). Mr. Zhu holds
Execution of Web Services,’’ IBM Systems Journal 44, No. B.S. and M.S. degrees in computer science from Shanghai
4, 821–845 (2005). JiaoTong University, China. He is a Ph.D. candidate in Peking
University. He works on technologies to provide Web-
9. H. Liu, Z. J. Li, J. Zhu, and H. F. Tan, ‘‘Business Process delivered business services to small and medium business. His
Regression Testing,’’ Proceedings of the International current research interests include software and solution
Conference on Service Oriented Computing, Vienna, engineering, SOA and modeling, and testing and industry
Austria, 2007, pp. 157–168. solutions. He is a member of the ACM.
10. T. Katayama, E. Itoh, Z. Furukawa, and K. Ushjima,
‘‘Test-case Generation for Concurrent Programs with the Naomi M. Mitsumori
Testing Criteria Using Interaction Sequences,’’ Proceed- IBM Global Services, 4400 North First Street, Suite 100,
ings of the 6th Asia Pacific Software Engineering San Jose, CA 95134 (naomi@us.ibm.com). Ms. Mitsumori
Conference, Takamatsu, Japan, 1999, pp. 590–597. holds a B.S. degree in chemical engineering from the
University of California, Berkeley, and an M.S. degree in
11. R.-D. Yang and C.-G. Chung, ‘‘Path Analysis Approach to
computer science from George Mason University. She has
Concurrent Program Testing,’’ Information and Software
worked with internal and external clients on projects ranging
Technology 34, No. 1, 43–56 (1992).
from life-cycle testing (specializing in test design, automation,
12. R. N. Taylor, D. L. Levine, and C. D. Kelly, ‘‘Structural and performance) to database application design and
Testing of Concurrent Programs,’’ IEEE Transactions on programming. She designed the technical infrastructure of the
Software Engineering 18, No. 3, 206–215 (1992). IBM Certification Test Center and the IBM Common
13. F. Budinsky, D. Steinberg, E. Merks, R. Ellersick, and T. J. Development Test Laboratory and defined and implemented
Grose, Eclipse Modeling Framework, Addison-Wesley the IBM Business Transformation and Chief Information Office
Professional, Boston, 2003. Testing Standards and Guidelines. Additionally, she has
established and trained test engineers in China, India, Mexico,
14. N. Eén and N. Sörensson, The MiniSat Page, http:// Japan, Australia, and North America. Currently, as an IBM
minisat.se/Links.html. Distinguished Engineer and the Application Services CTO of
15. J. Forrest and R. Lougee-Heimer, CBC User Guide, http:// Test, her activities include the definition and rollout of the
www.coin-or.org/Cbc/. IBM testing services offerings with a global IBM team. &
16. WebSphere Business Modeler, IBM Corporation, http://
www-306.ibm.com/software/integration/wbimodeler/.

Accepted for publication February 5, 2008.


Published online July 30, 2008.

Zhong Jie Li
IBM Research Division, IBM China Research Laboratory, 2F,
Diamond Building, ZGC Software Park, Haidian District,
Beijing, P.R.C. 100094 (lizhongj@cn.ibm.com). Dr. Li holds
B.S., M.S., and Ph.D. degrees in computer science from
Tsinghua University, Beijing. He joined the IBM Research
Division in 2004 and has worked in the Service Building
Technologies department. He has worked on applying
patterns for e-business (P4eb) and on SOA testing. His

472 LI ET AL. IBM SYSTEMS JOURNAL, VOL 47, NO 3, 2008

You might also like