<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Does my service have unspeci ed behavior?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Kathrin Kaschner</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Niels Lohmann</string-name>
          <email>niels.lohmanng@uni-rostock.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universitat Rostock, Institut fur Informatik</institution>
          ,
          <addr-line>18051 Rostock</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Services are loosely coupled interacting software components. Since two or more services are usually composed to one software system, the behavior of an implemented service should not di er to its speci cation. Therefore we propose an approach to test, if the implementation contains unspeci ed behavior. Due to the interacting nature of services this is a nontrivial task.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        In the paradigm of service-oriented computing (SOC) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], services are
encapsulated, self-contained functionalities. Usually, they are not executed in isolation,
but interact with each other via a well-de ned interface. Thereby, the
interaction between services follows complex protocols and goes far beyond simple
remote-procedure calls (i. e., request/response operations). Arbitrary complex
and possibly stateful interactions on top of asynchronous message exchange are
common. Finally, a system can be composed by a set of services.
      </p>
      <p>Best practices propose that systems should be speci ed prior to their
implementation. A speci cation of a service (e. g., an abstract WS-BPEL process)
describes its interface and the possible interactions with other services.
Furthermore it already contains all relevant internal decisions of the control ow (e. g.,
the criteria whether or not a credit should be approved) and data about
nonfunctional properties. In contrast, implementation-speci c details (e. g., whether
amounts are represented as integers or oats) are usually not yet de ned.</p>
      <p>Ideally, an implementation should conform to its speci cation. This means,
all speci ed properties should be implemented. But it is obviously not always
possible to verify the conformance in a formal proof. Furthermore veri cation is
excessively elaborate and therewith often too expensive. Thus, it is customary to
test the implementation.</p>
      <p>As Dijkstra stated, program testing can be a very e ective way to show the
presence of bugs, but is hopelessly inadequate for showing their absence. To
nevertheless be able to make a statement about the correctness of an implementation,
a test suite with a signi cant number of test cases is necessary.</p>
      <p>Testing services received much attention both in academia and industry.
However, the communicating nature of services is often neglected. Instead of
taking the new characteristics of SOC into account, existing work on testing
classical software systems was slightly adapted to cope with the new languages
used to implement services. Consequently, these approaches only take the internal
behavior of a service into account, but ignore the interactions with other services.
Others in turn are restricted to stateless remote-procedure calls. Both might lead
to undetected errors.</p>
      <p>
        However, communication is an essential part of the speci cation of interacting
services and consequently it is crucial to check it during conformance testing.
That means, any interaction derived from the speci cation also has to be a correct
interaction of the implementation and vice versa. In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], we presented an approach
to generate a test suite to test the former. In this paper, we propose how to test if
undesired (i.e., unspeci ed) interactions are implemented in the service. Because
the tester does not need knowledge about the code of the implementation, our
approach is a black-box testing method.
      </p>
      <p>This paper is organized as follows. Section 2 describes how a service
implementation can be tested using partners. Section 3 recalls the approach to generate test
cases and introduces an example protocol we use to demonstrate the approach.
Section 4 provides the main contribution of this paper with the elaboration of
test cases that are able to detect unspeci ed behavior of an implementation.
Section 5 concludes the paper and gives directions to future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Testing interacting services</title>
      <p>An adequate software test needs to check all speci ed properties. Due to the
fact that protocols are an essential part of service speci cations, they likewise
have to be considered during service testing. A protocol describes in which state
a service can send or receive which messages (and also which messages are not
allowed in that state). In this way, all possible interactions with other services
are de ned which leads to an implicitly speci ed set S of all partners. Thereby
a partner is again a service. If the speci ed service is implemented correctly, a
partner always interacts deadlock-freely with it. In contrast non-partners violate
the protocol; that is, during interaction the implemented service might deadlock.
For this paper, we assume \correct interaction" between two services means
deadlock freedom of their composition. We are well aware that there are other
possibilities for de ning \correct interaction". Nevertheless, deadlock freedom
will certainly be art of any de nition, so this paper can be seen as a step towards
a more sophisticated setting.</p>
      <p>
        We claim that like a function call is the most natural test case to test a
function of a classical program, a partner service is likewise the most natural
test case for a given service [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Thus, testing the protocol means testing whether
the implemented service does not exclude speci ed partners, and also whether it
does not include undesired partners. The former is important, because partner
exclusion might have a nancial impact if the service implements a business
process | loosing a partner might result in deadlocks which again yields to
down-time and contractual penalties. Testing the latter aims to exclude that
additional behavior is implemented. For instance, an online shop should not
terminate successfully if a customer did not pay for received goods. Consequently,
we distinguish two kinds of test cases: services P 2 S (partners), from which
we expect a deadlock-free interaction with the implementation, and services
Q 2= S (non-partners), from which we expect the interaction does not terminate
successfully (e.g., a deadlock will occur). Figure 1 illustrates our idea of exploiting
the properties of the partners and non-partners for testing services. Ideally, the
implementation contains exactly the speci ed behavior, that means, that S should
be equal to the set I of correct interacting partners of the implementation (S = I).
Otherwise, the implementation excludes a speci ed partner (SnI 6= ;) or the
implementation is able to terminate successfully with a non-partner (InS 6= ;).
specified and
implemented
partners (ideal)
      </p>
      <p>specified, yet
unimplemented
partners (undesired)</p>
      <p>S</p>
      <p>I
implemented, yet
unspecified partners
(undesired)</p>
      <p>
        To calculate S we can transform the speci cation into a formal model from
which a description (operating guideline) of all partners can be generated [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
Unfortunately, the set I cannot be calculated in the setting of black box testing.
Thus, we need to test how I behaves with respect to S.
      </p>
      <p>The general test procedure for interacting services can be sketched as follows.
We have a test suite containing the test cases P 2 S and another one containing
the test cases Q 2= S. The service to be tested is deployed in a testing environment
together with the two test suites. To process both test suites, the contained test
cases are executed one after the other. Thereby, each test case interacts by message
exchange with the service under test. The testing environment then is responsible
for logging and evaluating exchanged messages. We thereby assume the test
environment is able to detect whether the implementation terminates properly;
for instance, whether a BPEL process instance has completed successfully.</p>
      <p>A test run with a service P 2 S fails if the test run terminates, but the
implementation did not reach a nal state. Then a deadlock has occurred and the
implementation is incorrect. P can serve as a witness that the implementation
excludes at least this speci ed partner service (SnI 6= ;). A test run that does
not terminate, or terminates, but leaves the implementation in a nal state, is
inconclusive; that is, the run neither witnesses an error nor can proof overall
correctness. Note that our approach is currently centered around deadlock freedom.
In this setting, in nite runs are considered correct, because they do not contain a
deadlock. Furthermore, the test environment cannot detect in nite runs and has
to abort the test at some point, yielding an inconclusive result. But even if, for
each partner service P 2 S, the run terminates and the implementation reaches
a nal state, we cannot conclude that the implementation does not exclude
a speci ed partner service. We only know, that there exists a successful run
for each speci ed partner. Since during testing the partner service (the tester)
cannot control all internal decisions of the service. Hence, an incorrect part of the
implementation may not executed during the test at all. However, a systematic
test approach with a signi cant number of test cases can increase the likelihood
of detecting an error.</p>
      <p>
        The set S contains a large number of many services (usually even in nitely
many). It is therefore not practical to test a service with every P 2 S. In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ],
we presented an approach how a small subset of S can be selected. With this
reduced test suite, it is possible to detect all errors that could also be detected
with the complete set S.
      </p>
      <p>Canonically, a test run with a non-partner service Q 2= S fails, if the test run
terminates and the implementation is in a nal state. Thereby, Q is a witness
that the implementation supports undesired partner services (InS 6= ;). Test
runs of the composition of the implementation and the test case that neither
terminate nor leave the implementation in a nal state are inconclusive.</p>
      <p>In Sect. 4 we will explain how the non-partner can be derived from the
speci cation. This is a nontrivial task, because not all partner services Q 2= S
are suitable for testing. As demonstrated by the following example, there exist
some Q0 2= S which can fail even trough the implementation is correct.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Example</title>
      <p>
        To formally reason about the speci cation of a service, an exact mathematical
model is needed. We use open nets [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], a special class of Petri nets [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] as a
formalism for protocols. Using existing translations, they can be easily derived
from industrial languages such as WS-BPEL or BPMN. As running example for
this paper, consider the open net from Fig. 2(a). It models a protocol of a buying
service which receives and evaluate o ers. It either accepts an o er and waits for
an invoice, or rejects the o er and returns to its initial state. The nal marking
of this net is the marking [!] which only marks the place !: the control ow
reached its end and all message channels are empty. Final markings distinguish
desired end states from undesired deadlocks.
      </p>
      <p>offer
reject
accept
invoice
?o</p>
      <p>!r
!a
?i
ω
!invoice ∨ !offer</p>
      <p>
        From this model, an operating guideline (OG) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] can be calculated (see
Fig. 2(b)). An operating guideline is a nite automaton whose edges are labeled
with message events (sending events are preceded by ! and receiving events are
preceded by ?) and whose states are annotated with Boolean formulae. These
formulae express which edges of a partner must be present to guarantee deadlock
freedom. For example, \!invoice _ !o er" expresses the requirement that every
partner has to initially send an invoice or an o er, or make a decision between
both during runtime. Likewise, \?reject ^ ?accept" states that the receipt of
both messages must be possible in that state. The operating guideline nitely
characterizes the in nite set of all deadlock-free interacting partners S of the
buying service and hence all test cases for the speci ed protocol.
      </p>
      <p>Two test cases are depicted in Fig. 2(c) and 2(d). While the rst test case
sends the invoice only after receipt of an acceptance message, the second exploits
asynchronicity and sends the invoice right after sending the o er. In both cases,
the OG's annotations are ful lled.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Testing for unspeci ed behavior</title>
      <p>As mentioned earlier, the operating guideline can used to generate the test suite
containing all necessary partners the test if SnI = ; holds. To be able to make
a statement about these InS deviations (i.e., unspeci ed partners), a di erent
approach is needed. This is due to the fact that a service that is not characterized
by the does not necessarily yield a deadlock. For example, a service without the
ability to receive a rejection message (see Fig. 3(a)) may deadlock with the buyer
service if the latter rejects the o er. If, however, the o er is accepted, no deadlock
occurs. Hence, any result of this test case would be inconclusive.</p>
      <p>To this end, the operating guideline of the speci ed protocol cannot be
used to derive InS-test cases. To characterize all services that are expected
to deadlock when composed to the implementation, we need to reinterpret the
nal states of the protocol: If we complement the set of nal markings, then
the operating guideline of this anti-protocol (called the anti operating guideline)
characterizes partners that interact without deadlock with the anti-protocol.
That is; the interaction terminates in a nal state of the anti-protocol. This in
turn is a deadlock of the original protocol. Hence, the anti operating guideline
characterizes partners that are expected to deadlock with the original protocol.</p>
      <p>For the example of Fig. 2(a), any marking but [!] would be a nal marking
of the anti-protocol. Note that the structure of the anti-operating guideline of
Fig. 2(b) is very similar to the original operating guideline (cf. Fig. 3(b)) and
we see that the interactions that would lead to the a nal state in Fig. 2(b) (e.g.
!o er ?accept !invoice) lead to the only state without nal in the annotation in
Fig. 3(b).</p>
      <p>
        Three test cases characterized by the anti operating guideline are depicted
in Fig. 3(c){3(e): the rst two exploit the fact that premature termination will
lead to a deadlock with a conformant implementation, whereas the last test case
avoids a valid nal marking by sending another o er.
?reject
Several works exist to systematize testing of Web services (see [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] for an overview).
Test case generation can be tackled using a variety of approaches such as control
ow graphs [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], model checking [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], or XML schemas [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. These approaches mainly
focus on code coverage, but do not take the interacting nature of Web services into
account. In particular, internal activity sequences are not necessarily enforceable
by a test case. Therefore, it is not clear how derived test cases can be used for
black-box testing in which only the interface of the service under test is available.
      </p>
      <p>
        To the best of our knowledge, none of the existing testing approaches take
stateful business protocols implemented by Web services into account, but mainly
assume stateless remote procedure calls (i. e., request-response operations), see for
instance [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Bertolino et al. [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] present an approach to generate test suites for
Web services and also consider nonfunctional properties (QoS). Their approach,
however, bases on synchronous communication and is thus not applicable in the
setting of SOAs.
      </p>
      <p>
        Finally, several tools such as the Oracle BPEL Process Manager [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] or
Parasoft SOAtest [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] support testing of services, but do not speci cally focus
on the business protocol of a service. In contrast, Mayer et al. [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] underline the
importance of respecting the business protocol during testing, but do not support
the generation of test cases in their tool BPELUnit.
6
      </p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>
        We presented an approach to generate test cases from a speci cation protocol
and show how they can be used to check whether an implementation introduces
unspeci ed behavior. This test suite is not complete in the sense that we cannot
detect all deviations from the speci cation. The reason for this lies in the nature
of services in which decisions may not always be enforceable by the environment.
To this end, we introduced anti operating guidelines to characterize SnI test
cases that must deadlock when composed to a compliant implementation. The
results of this paper are de ned in terms of open nets and are independent of
a concrete protocol speci cation language. With existing translation, e.g. from
BPEL to open nets and vice versa [
        <xref ref-type="bibr" rid="ref14 ref15">14, 15</xref>
        ], the approach is easily applicable to
industrial languages.
      </p>
      <p>
        In future work, we plan to propose a test case coverage criterion to select
a small number of test cases which still can detect the same errors that are
detectable with the complete set of test cases. Indications are that this criterion
should be similar to the criterion we proposed for InS test cases [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Finally, the
test case selection procedures need to be implemented to validate the test suite
generation with industrial case studies.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Papazoglou</surname>
            ,
            <given-names>M.P.</given-names>
          </string-name>
          :
          <article-title>Agent-oriented technology in support of e-business</article-title>
          .
          <source>Communications of the ACM</source>
          <volume>44</volume>
          (
          <issue>4</issue>
          ) (
          <year>2001</year>
          )
          <volume>71</volume>
          {
          <fpage>77</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Kaschner</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lohmann</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          :
          <article-title>Automatic test case generation for interacting services</article-title>
          .
          <source>In: ICSOC Workshops</source>
          <year>2008</year>
          . LNCS, Springer (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Lohmann</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Massuthe</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wolf</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>Operating guidelines for nite-state services</article-title>
          .
          <source>In: ICATPN 2007</source>
          .
          <article-title>Volume 4546 of LNCS</article-title>
          ., Springer (
          <year>2007</year>
          )
          <volume>321</volume>
          {
          <fpage>341</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Massuthe</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reisig</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidt</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>An operating guideline approach to the SOA</article-title>
          .
          <source>Annals of Mathematics, Computing &amp; Teleinformatics</source>
          <volume>1</volume>
          (
          <issue>3</issue>
          ) (
          <year>2005</year>
          )
          <volume>35</volume>
          {
          <fpage>43</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Reisig</surname>
          </string-name>
          , W.:
          <article-title>Petri Nets</article-title>
          .
          <source>EATCS Monographs on Theoretical Computer Science edn</source>
          . Springer (
          <year>1985</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Baresi</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nitto</surname>
          </string-name>
          , E.D., eds.
          <source>: Test and Analysis of Web Services</source>
          . Springer (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Yan</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sun</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          , Zhang, J.:
          <article-title>BPEL4WS unit testing: Test case generation using a concurrent path analysis approach</article-title>
          .
          <source>In: ISSRE</source>
          <year>2006</year>
          , IEEE (
          <year>2006</year>
          )
          <volume>75</volume>
          {
          <fpage>84</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Garc</surname>
            a-Fanjul,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tuya</surname>
            , J., de la Riva,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Generating test cases speci cations for BPEL compositions of Web services using SPIN</article-title>
          . In: WS-MaTe
          <year>2006</year>
          . (
          <year>2006</year>
          )
          <volume>83</volume>
          {
          <fpage>94</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Hanna</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Munro</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>An approach for speci cation-based test case generation for Web services</article-title>
          . In: AICCSA, IEEE (
          <year>2007</year>
          )
          <volume>16</volume>
          {
          <fpage>23</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Bertolino</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Angelis</surname>
            ,
            <given-names>G.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Frantzen</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Polini</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Model-based generation of testbeds for web services</article-title>
          .
          <source>In: TESTCOM/FATES 2008. LNCS 5047</source>
          , Springer (
          <year>2008</year>
          )
          <volume>266</volume>
          {
          <fpage>282</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. Oracle: BPEL Process Manager. (
          <year>2008</year>
          ) http://www.oracle.com/technology/ products/ias/bpel.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. Parasoft: SOAtest. (
          <year>2008</year>
          ) http://www.parasoft.com.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Mayer</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          , Lubke, D.:
          <article-title>Towards a BPEL unit testing framework</article-title>
          .
          <source>In: TAV-WEB '06</source>
          ,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2006</year>
          )
          <volume>33</volume>
          {
          <fpage>42</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Lohmann</surname>
          </string-name>
          , N.:
          <article-title>A feature-complete Petri net semantics for WS-BPEL 2.0</article-title>
          . In: WS-FM
          <year>2007</year>
          .
          <article-title>Volume 4937 of LNCS</article-title>
          ., Springer (
          <year>2008</year>
          )
          <volume>77</volume>
          {
          <fpage>91</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Lohmann</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kleine</surname>
          </string-name>
          , J.:
          <article-title>Fully-automatic translation of open work ow net models into simple abstract BPEL processes</article-title>
          .
          <source>In: Modellierung</source>
          <year>2008</year>
          . Volume P-127 of LNI.,
          <source>GI</source>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>