Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Abstract—With the increase of the popularity of Web Service, constraining facets [3, 4] that can be found in WSDL
more and more web applications are developed with this new specification of the Web Service under test.
kind of components. Web Service quality validation and control
is becoming very critical to vendors, brokers and application This paper is structured as follows. Section 2 presents a
builders. Both brokers and users usually have to use black-box background on relevant concepts and other works in the area of
testing because design and implementation details of Web Service testing Web Service. Section 3 presents a formal model and its
are unavailable. This paper proposes a formal approach for automatic construction and proposes the test data generation
automated test data generation for Web Service single operation algorithm based on the model, and also we present an
based on WSDL specification. Firstly, we define a formal model application example. Remarks and outlook for future research
for the datatype of input element of the operation. Secondly, the are presented in Section4.
paper presents an algorithm that derives the model from WSDL.
Thirdly, the paper presents a method that generates test data for
II. BACKGROUND AND RELATED WORKS
operations from the model. Examples of using this approach are
given in order to give evidence of its usefulness.
A. Background
Keywords- web service; automated test data generation;WSDL; WSDL is a XML-based language to define Web Services
and the access to them. It specifies the location of the service
I. INTRODUCTION (HEADING 1) and the operations or methods that the service exposes. The
following is a pseudo-content model of WSDL description.
Web Service-based software system may be composed of
hundreds of these reused Web Services. However, if the quality <description>
of just a single of these Web Services is poor, it may greatly <documentation />?
destroy the overall quality of the entire system. Web Service [ <import /> | <include /> ]*
quality validation and control becomes very critical to vendors,
brokers and application builders. Both brokers and users <types />?
usually have to use black-box testing because WSDL [ <interface /> | <binding /> | <service /> ]*
specifications are available but design and implementation </description>
details of Web Services are not.
The Interface is a set of operations. An operation is a
Testing Web Service includes two different levels for sequence of input and output elements. Input elements are
brokers and users, such as: similar as the parameters of a function call in a traditional
1) Testing the single operation of Web Service; programming language.
2) Testing the operations sequence of Web Service.
The types define the datatypes of input element for each
Regardless of stateless and stateful service [12], testing
operation. Input element types could be defined in various
single operation of Web Service is necessary. This paper
schema languages. In this paper, we will only focus on the use
focuses on testing the single operation of Web Service.
of XML Schema datatypes since it's natively supported by
Compared with testing the single operation of other software
WSDL2.0 for maximum platform neutrality. Based on the
components, testing Web Service is different because input
types definition, the input element type model is built in section
element type of Web Service operation is based on XML
3.2.
schema datatypes and their associated constraining facets.
Therefore this paper proposes an approach to automated test XML Schema datatypes include built-in datatypes, simple
data generation for single operation of Web Service based only datatypes and complex datatypes. Built-in datatypes are those
on the WSDL (Web Services Description Language) [1, 2]. which are defined in the XML Schema. Simple datatypes are
This solution depends on input element type model which is a those which are defined with the <xs:simpleType…> by user.
formal model of the XML Schema datatypes and their A simple datatype could be obtained from a built-in datatype or
another simple datatype by one of three means: by restriction,
732
• D=S∪B. S is a finite set of simple datatypes nodes in
input element type definition. B is the set of built-in Input: The type definition of input element ‘x’ in WSDL.
datatype nodes in input element type definition. Output: The type model tree T of input element ‘x’.
• nr is the root node. Input element will be modeled the Step 1: (1) Let N=∅, D =∅, IC=∅, RC=∅, EE=∅ and ED
root node. =∅; (2) A new node ‘n’ is produced with the name of
• IC is a finite set of constraints between elements in input element ‘x’; (3) Let nr = n.
N∪nr and elements in N. ∀x ∈ IC , denoted as Step 2: (1) If the datatype of ‘n’ is a complex datatype
x=<facet1,value1> or x=<facet1,value1> && then continue with Step 3; (2) If the datatype of ‘n’ is a
<facet2,value2>. The operator && denotes two facets built-in datatype then continue with Step 4; (3) Otherwise
“and” together. According to XML Schema Structures, continue with Step 5.
<faceti, valuei>(1≤i≤2) is one of the following
constraints: (1) <maxOccurs, non-NegativeInteger>; Step 3: (1) A new node ‘m’ with one of n_ sequence,
(2)<maxOccurs, unbounded>; (3)<minOccurs, n_choice or n_all and an edge e(n, x, m) are produced,
nonNegativeInteger>. The default value for minOccurs where x= φ; (2) Let N=N∪{m}, EE=EE∪{e}, n=m; (3)
and maxOccurs is “1”. IC presents the constraints
For each sub-element of the complex datatype, the new
between complex datatypes and their respective sub-
elements. node ‘m’ with the name of the sub-element and an edge
e(n, x, m) are produced, where ‘x’ is the facet which
• RC is a finite set of constraints between elements in
N ∪ n r ∪ D and elements in D. ∀x ∈ RC , denoted as constrains the sub-element, and let N=N∪{m}, EE = EE ∪
x=<facet1,value1> op1 <facet2,value2> op2 … opn {e}, IC=IC∪{x}, n=m, and then Continue with Step2.
<facetn,valuen>, where opi = && or opi = ||, Step 4: (1) We assume that the built-in datatype is b. A
1 ≤ i ≤ n , The operator “||” denotes the facets pattern new node ‘m’ with n_b and an edge e(n,x,m) are
and enumeration "or" together. The operator “&&” produced, where x=φ; (2) Let B=B∪{m},ED= ED∪{e}.
denotes all other facets “and” together. Table 1 lists
Step 5:
these facets. RC presents the constraints between
simple datatypes and simple datatypes, and the IF ‘n’ is defined by using a built-in data type or another
constraining facets for built-in datatypes. simple datatype as the restriction base THEN
• EE is a finite set of edges. ∀e ∈ EE , denoted as (1) A new node ‘m’ with the restriction base and an
e(p, x, c), where p ∈ N ∪ n r , c ∈ N, x ∈ IC ∪ {φ}. edge e(n,x,m) are produced, where ‘x’ is the facet for
the base; (2) If the restriction base of ‘n’ is built-in
• ED is a finite set of edges. ∀e ∈ ED , denoted as
datatype then let B=B∪{m}, ED=ED∪{e}, RC = RC
e(p, x, c), where p ∈ N ∪ D, c ∈ D, x ∈ RC ∪ {φ}.
∪{x}; (3) If the restriction base of ‘n’ is another simple
The edges in EE and ED make up two different kinds datatype then let S=S∪{m}, ED=ED∪{e}, RC = RC ∪
which correspond to two types of constraints in IC and RC. For
an edge e(p, x, c) in EE and ED, x = φ is denoted as no {x}, n =m, and continue with Step 5.
constraint. The node ‘c’ is called the child of the node ‘p’. The ENDIF
node ‘p’ is called the parent of the node ‘c’. ‘x’ means that the IF the simple data type of ‘n’ is a list data type THEN
node ‘p’ constrains the node ‘c’. (1) A new node ‘m’ with the list item and an edge
e(n,x,m) are produced, where ‘x’ is the restriction facet
B. Input Element Type Model Construction Algorithm
for the list; (2) Let S=S∪{m}, ED=ED∪{e},
Figure 1 shows how to construct the input element type
model from the types definition in preprocessed WSDL RC=RC∪{x}, n =m; (3) Continue with Step 5.
specification. In the generated model, Input element is modeled ENDIF
as root node of the model tree, and the nodes in B are the leaf IF the simple data type of ‘n’ is a union type THEN
nodes.
FOR each member in union type
Figure 2 provides an example, the preprocessed WSDL (1) Build a new node ‘m’ with member type, an
specification for order, to implement the function of submitting
edge e(n,x,m) is also produced, where x=φ; (2)
the order. Figure 3 shows the type model tree of the input
element OrderRequest generated by the algorithm presented in Let B=B∪{m} , ED=ED∪{e} , RC=RC∪{x},
Figure 1. n=m; (3) Continue with Step 5.
ENDFOR
C. Test Data Generation for input element
ENDIF
We first generate test data for built-in datatype nodes in the
set B which are leaf nodes in input element type model tree, Figure 1. Algorithm for input element type model construction
733
<wsdl:types> <xs:element name="orderItem" type="item" <xs:simpleType>
<xs:element name="OrderRequest" maxOccurs="unbounded" /> <xs:restriction base="xs:string">
<xs:complexType> </xs:sequence> <xs:maxLength value="10"/>
<xs:sequence> </xs:complexType> <xs:minLengh value="10"/>
<xs:element name="custid" minOccurs="0"> </xs:element> </xs:restriction>
<xs:simpleType> <xs:simpleType name="priceType"> </xs:simpleType>
<xs:restriction base="xs:string"> <xs:restriction base="xs:decimal"> </xs:element>
<xs:maxLength value="10"/> <xs:fractionDigits value="2"> <xs:element name="quantity" minOccurs="0"/>
<xs:minLength value="10"/> <xs:maxInclusive value ="10000"/> <xs:simpleType>
</xs:restriction> </xs:restriction> <xs:restriction base="xs:positiveInteger">
</xs:simpleType> </xs:simpleType> <xs:maxInclusive value="100"/>
</xs:element> <xs:complexType name="item"> </xs:restriction>
<xs:element name="ordid"> <xs:sequence> </xs:simpleType>
<xs:simpleType> <xs:element name="itemid"> </xs:element>
<xs:restriction base="xs:string"> <xs:simpleType> </xs:sequence>
<xs:maxLength value="10"/> <xs:restriction base="xs:string"> </xs:complexType>
<xs:minLength value="10"/> <xs:maxLength value="10"/> </wsdl:types>
</xs:restriction> <xs:minLengh value="10"/> <wsdl:interface name="Order">
</xs:simpleType> </xs:restriction> <wsdl:operation name="order" >
</xs:element> </xs:simpleType> <wsdl:input element="OrderRequest" />
<xs:element name="price" type="priceType" </xs:element> </wsdl:operation>
minOccurs="0" /> <xs:element name="prodid" minOccurs="0"/> </wsdl:interface>
e0=(OrderRequest,x0,OrderRequest_sequence) x0=
OrderR- e1=(OrderRequest_sequence,x1,custid) x1=(minOccurs, "0") (maxOccurs,"1")
equest e2=(custid,x2,string) x2=(maxLength,"10") (minLength,"10")
e3=(OrderRequest_sequence,x3,ordid) x3=(minOccurs, "1") (maxOccurs,"1")
e0 x4=(maxLength,"10") (minLength,"10")
e4=(ordid,x4,string)
e5=(OrderRequest_sequence,x5,price) x5=(minOccurs,"0") (maxOccurs,"1")
OrderRequest_
e6=(price,x6,decimal) x6=(fractionDigits,"2") maxInclusive,"10000"
sequence e7
e1 e7=(OrderRequest_sequence,x7,orderItem) x7=(minOccurs,"1")
e3 e5 e8=(orderItme,x8,orderItme_sequence) (maxOccurs,"unbounded")
custid e9=(orderItme_sequence,x9,itemid) x8=
ordid order- e10=(itemid,x10,string) x9=(minOccurs, "1") (maxOccurs,"1")
price Item x10=(maxLength,"10") (minLength,"10")
e2 e11=(orderItme_sequence,x11,prodid)
e4 e12=(prodi,x12,decimal) x11=(minOccurs, "0") (maxOccurs,"1")
e6 e8
e13=(orderItme_sequence,x13,quantity) x12=(maxLength,"10") (minLength,"10")
custid_
ordid_ orderItem e14=(quantity,x14,positiveInteger) x13=(minOccurs, "0") (maxOccurs,"1")
string price_
string -sequence x14 maxInclusive,"100"
decimal
OrderRequestT=(N,D,IC,RC,EE,ED,nr)
e13
e9 e11 N={OrderRequest, OrderRequest_sequence,custid, ordid, pirce, orderItem,
orderItem_sequence, itemid, prodid, quantity}; nr=OrderRequest
itemid quantity D=BUS; B={custid_string, ordid_string, price_decimal, itemid_string,
prodid
e14 prodid_decimal, quantity_positiveInteger};S=
e10 e12 C={x0, x1, x3, x5, x7, x8, x9, x11, x13}; RC={x2, x4, x6, x10, x12, x14}
quantity_ EE={e0, e1, e3, e5, e7, e8, e9, e11, e13}; EC={e2, e4, e6, e10, e12,e14}
itemid_string prodid_string positiveInteger
Figure 3. The type model tree of input element OrderRequest. datatype, we will iteratively decide whether the parent ‘o’ of
the node ‘n’ is a simple datatype. The constraints between
and then obtain test data for the nodes in the set N∪S∪nr from simple datatypes and simple datatypes will constrains the node
the bottom up according to the relationships among nodes in ‘m’ in further constraining facets, so we must obtain test data
model. Finally, we can obtain the test data set of the node nr for based on the all constraining facets including the constraints
input element. between simple datatypes and simple datatypes for the node
‘m’.
1) Obtain test data for built-in datatype nodes in the set B
In this section, we apply the constraints in RC to obtain test According to black-box testing strategy (e.g. boundary
data for built-in datatype nodes. Figure 4 is the algorithm that value, equivalence class, or random testing), we could build a
obtains the test data for the built-in datatype nodes. If the knowledge base for the built-in datatypes and their constraints.
parent of the node ‘m’ in B is not a simple datatype, we can In this knowledge base each XML Schema built-in datatype is
directly get test data based on the facets which constrains the associated with rules to generate test data based on the
node ‘m’. If the parent ‘n’ of the node ‘m’ in B is a simple constraining facet and the value for that constraint [11].
734
2) Relationships among nodes in model
Algorithm: obtaining test data set for each built-in In this section, we will apply the constraints in IC to fetch
datatype. the relationships among nodes in the model. The relationships
facilitate the process obtaining test data of input element from
Input: T=<N, D, nr , IC, RC, EE, ED>. the bottom up with the model tree T. We assume that the model
FOR each node ‘m’ in B and edge e(n,x,m) T=<N, D, nr , IC, RC, EE, ED >. The relationships definition
IF n∈N THEN among nodes in input element type model is as follow:
According to the black-box testing (e.g. boundary • m→i1∗n1+ i2∗n2+……+ ij∗nj , where 1≤ ij, j≤1. For the
value, or equivalence class, or random testing), we node ‘m’, ‘n1’ , ‘n2’,….. , ‘nj’ in T, the node ‘n1’,
generate valid or invalid test data for the built-in ‘n2’,….. , ‘nj’ are the child elements of the node ‘m’.
The child node ‘nk’ can occur ik times (1≤k≤j).
datatype ‘m’ with constraint ‘x’.
ELSE • m→sequence(i1∗n1+ i2∗n2+……+ ij∗nj), where 1≤ ij,
1≤ j. The child elements of the node ‘m’ may appear in
Let y=x;
a same order as in the formula.
FOR e(o,x,n) and o∈S
• m→choice(i1∗n1+ i2∗n2+……+ ij∗nj), where 1≤ ij, 1≤ j.
IF(x≠φ) THEN Only one of child elements of the node ‘m’ may appear.
y=y&&x;
• m→all(i1∗n1+ i2∗n2+……+ ij∗nj), where 1≤ij, 1≤ j.
ENDIF The child elements of the node ‘m’ may appear in any
n=o; order.
ENDFOR Figure 5 is the algorithm that obtains the relationships
IF e(o,x,n) and o∈N and x≠φ THEN among nodes in the model T according to edges in EE and EC
y=y&&x; and the constraints in IC.
ENDIF Combining all the possible values of minOccurs and
According to the black-box testing, we generate valid maxOccurs defined for each child of complex datatype is
infeasible. To settle this problem, here we associated a random
or invalid test data for the built-in datatype ‘m’ with
value taken from the input domain with the occurrences of each
constraint ‘y’. element in the algorithm. We could also associate values taken
IFEND from the input domain with the occurrences of each element
ENDFOR according to boundary values, or equivalence. In the future we
will evaluate which solution is better.
Figure 4. Deriving test data for the built-in datatype nodes in the model
The relationships of input element OrderRequest in Figure
3 which are obtained by the algorithm presented in Figure 5 are
TABLE II. TEST DATA FOR THE BUILT-IN DATATYPES as follow:
Knowledge Base • orderRequest→orderRequest_Sequence
Built-in types Constraining facet and Valid and invalid
constraint value values • orderRequest_Sequence→custid+ordid+price+
(custid)string
(maxLength,”10”)&&(minLen xx00xx00xx, 3∗orderItem
gth, “10”) a001
(maxLength,”10”)&&(minLen yy00371102, • orderItem→orderItem_Sequence
(ordid)string
gth, “10”) b001
(fractionDigits,“2”)&&(maxInc • orderItem_Sequence→itmeid+prodid+quantity
(price)decimal 957.3, -978.56
lusive,“10000”)
(maxLength,”10”)&&(minLen c001uddddd, • custid→custid_string
(itemid)string
gth, “10”) c008888888e
(maxLength,“10”)&&(minLen 0371102345, • ordid →ordid_string
(prodid)string
gth,“10”) 037110234
(quantity)posi
• price→price_decimal
(maxInclusive,”100”) 45, 124
tiveInteger • itemid→itemid_string
For the type model tree of input element OrderRequest in
Figure 3, Table 2 lists the built-in datatypes, the constraints to • prodid→prodid_decimal
which their values must conform, and the generated test data
according to equivalence class testing. We divide the input • quantity→quantity_positiveInteger
domain into valid sub-domain and invalid sub-domain for each 3) Test data generation for input element from the input
built-in datatype and select one from each sub-domain at element type model
random. The steps for test data generation for each input element
from the input element type model are as follow:
Step 1: Obtain the test data set for each node in B.
735
the test data set for node ‘nk’ and i k ∗ n k _TD is the test data set
Algorithm: Obtaining relationships among nodes in the for the occurrence of ik times for the node ‘nk’. Then,
input element type model ik ∗ n k _TD is the Cartesian product of the test data for the node
Input: Input element type model T = <N, D, nr , IC, RC, ‘nk’ for ik times. Thus,
EE, ED>. i k ∗ n k _TD = n k _ TD1 × n k _ TD2 × ... × n k _TDi k
.
736
testing, partition testing and equivalence class testing can [5] X. Bai, W. Dong, W. Tsai, and Y. Chen, “WSDL-Based Automatic test
defect more faults in Web Services. case generation for Web Services testing”, Proseedings of the 2005
IEEE International Workshop on Service-Oriented System Engineering
Testing Web Service is expensive because for every test (SOSE’05),20-21 Oct. 2005, China, pp.215-220.
data we must send SOAP message to invoke Web Service [6] Y. Jiang, “A Method of Automated Test Data Generation for Web
under test and this message uses a lot of resources. Our future Service”, Chinese journal of computers, Vol. 28 No. 4 Apr. 2005.
research will try to minimize the test data using some [7] J. Offutt and W. Xu, "Generating Test Cases for Web Services Using
Data perturbation", ACM SIGSOFT, Software Eng. Notes, Vol. 29(5),
combinatorial approaches, such as AETG methodology [10], Sep. 2004, pp. 1-10.
and minimize service invocation by using monitoring data [11]. [8] W. Xu, J. Offutt, “Testing Web Services by XML perturbation”,
Software Reliability Engineering, 2005. ISSRE 2005. 16th IEEE
REFERENCES International Symposium on, 8-11 Nov. 2005, pp.1-10.
[9] Hanna Samer ,Munro Malcolm, “An Approach for Specification-based
[1] W3C, “Web Services Description Language (WSDL) Version 2.0 Part 0:
Test Case Generation for Web Services” , Computer Systems and
Primer” , W3C Recom-mendation ,26 June 2007,
Applications, 2007. AICCSA '07. IEEE/ACS International Conference
http://www.w3.org/TR/2007/REC-wsdl20-primer-20070626.
on ,13-16 May 2007, pp: 16-23.
[2] W3C, ” Web Services Description Language (WSDL) Version 2.0 Part
[10] D. Cohen, S.R.Dalal, M.L.Fredman, and G.C.Patton, “The AETG
1: Core Language” , W3C Recommendation ,26 June 2007,
system: an approach to testing beased on combinatorial Design”, IEEE
http://www.w3.org/TR/2007/REC-wsdl20-20070626.
Transactions On Software Engineering, 23(7), July 1997.
[3] W3C, “XML Schema Part 1: Structures Second Edition”, W3C
[11] Massimiliano Di Penta etc, Test and Analysis of Web Services ,
Recommendation, 28 October 2004, http://www.w3.org/TR/2004/REC- Publisher: Springer Berlin Heidelberg, Date: 2007.
xmlschema-1-20041028/.
[12] Brenner, Atkinson, “Strategies for the Run-Time Testing of Third Party
[4] W3C, “XML Schema Part2: Datatypes Second Edition”, W3C
Web Services” , IEEE International Conference on Service-Oriented
Recommendation, 28 Oct.2004, http://www.w3.org/TR /xmlsche-2/.
Computing and Applications (SOCA '07) pp. 114-121.
737