Professional Documents
Culture Documents
&
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
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
Build
IBM Rational RequisitePro*
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.
<<enumeration>>
ScopeTree ActivityDomain BFGNode ExecuteStatus
father +scopeName : String +inputAction : String +Executed
BFGProcess
+outputAction : String +NotExecuted
+nodes
+internalAction : String +name : String +DPE
+Ready
Figure 2
BFG metamodel
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
BFGNode Structure collecting common node attributes. A set of actions record the data calculations
(assignments) in the node
CompensateNode A special BPEL basic activity that must have a scopeName attribute
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
LoanRequest.amount<10000
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
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.
C AND Join
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.
partner ! process
Test-path exploration
Package explorer Selected WID BFG
artifacts Transform Generate
New views
Branch
Trace Trace analysis
Coverage Forest
Transform Correlate
Message
Test paths Trace model
Parse
Path comparison
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
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.
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
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