1 / 25

A Framework For Testing Web Services Based On XQPN Petri Nets

A Framework For Testing Web Services Based On XQPN Petri Nets. Piotr Szwed, Dariusz Wadowski and Krzysztof Paździora Institute of Automatics, AGH University of Science and Technology,. Agenda. Goal General description of the framework XQPN nets XQuery language XQPN nets definition

Télécharger la présentation

A Framework For Testing Web Services Based On XQPN Petri Nets

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Framework For Testing Web Services Based On XQPN Petri Nets Piotr Szwed, Dariusz Wadowski and Krzysztof Paździora Institute of Automatics, AGH University of Science and Technology,

  2. Agenda • Goal • General description of the framework • XQPN nets • XQuery language • XQPN nets definition • Modeling Web Applications with XQPN nets • Tested system • Architecture of the framework • Conclusion

  3. Goal Motivation • At present there exist several tools for testing web services (individual operations and manually prepared scenarios) • It is relatively difficult and time consuming to prepare manually reliable scenarios, especially in the presence of concurrent activities. Generating test scenario from a formal specification • Speeds up the testing process • Scenarios may be longer and provide better coverage • May help to detect potential conflicts between concurrent processes To develop a framework for automatic testing of web services (and web application based on web services) that uses as a formal specification the colored Petri net model.

  4. General description of the framework 1 • XML is used as the internal data format • The backbone of the framework are XQPN nets: especially developed new type of colored Petri nets capable of manipulating XML data.

  5. General description of the framework 2 To run tests four objects are required: • XQPN specification (validated by simulation) • Tested web application or a web service • Mapping between XQPN transitions and operations of the tested system • Relation between places in XQPN net and XML data representing a state of a tested system (the data base state, the XML data sent to the browser)

  6. General description of the framework 3 Tests • Tests are driven by randomly selected transitions in XQPN specification. • Simultaneously to firing a transition, the call to the corresponding operation of the tested system is executed. • Then, the conformity of the reached marking in XQPN and the tested system state is checked (both represented by XML data)

  7. XQPN (XQuery Petri Nets) • Colored Petri nets allowing manipulation of XML documents assigned to places. • In XQPN nets arcs are attributed with XQuery language expressions.

  8. XQPN – XQuery 1 • XQuery (XML Query Language) is a language designed for querying XML data, either XML documents or databases equipped with XML interface. • In January 2007 the language became an official recommendation of W3C organization. • Many implementations: • Saxon, Altova XML • Oracle, IBM DB2, Microsoft SQL Server

  9. XQPN – XQuery 2 • Superset of XPath • XQuery queries return nodesets, i.e. sequences of XML tags (nodes) or atomic values. • Capability of adding tags and modifying the structure of nodes (in a resulting sequence) • Capability of joining data originating from different documents • Defining variables and user functions • Calling external functions

  10. XQPN – XQuery 3 • FLWOR expressions for $x in /bookstore/book where $x/price>30 order by $x/title return $x/title • Assignment let $y := expression … • Conditional expressions if(condition)then exp1 else exp2

  11. XQPN nets - defintion XQPN = (P, T, A, Q, W, G) • P – set of places, • T – set of transitions, P  T =  • APTTP set of arcs, • Q: AQ, is a function assigning XQuery expressions to arcs, by Q we denote a set of XQuery expressions, • W: PT (N {*})  (N {*}) is a function assigning to input arcs pairs of symbols defining multiplicity. • G: TQ is a function assigning guards to transitions, i.e. XQuery expressions returning boolean values.

  12. XQPN nets - marking Marking in XQPN nets is a function M : P  M, assigning XML documents from a certain set M to places. It is assumed, that an identifier of a place p is a root node of a document M(p) assigned to a place pP

  13. XQPN – arcs and expressions • Input arcs • Delete XML nodes • Read (query) XML nodes • Expressions: XPath, FLWOR, assignment let $x := expression • Accepted non-cyclic dependency between input variables • Output arcs • Insert XML nodes to output places • Expressions • Can reference input variables • Accepted FLWOR expressions, if-then-else, adding new tags

  14. XQPN - example • A sequence of nodes satisfying the predicate [./@id>12] is assigned to the local variable $x • Nodes belonging to $xwill be moved from the place store to out <store> <item id='7'/> <item id='12'/> <item id='13'/> <item id='21'/> <item id='27'/> </store>

  15. XQPN - multiplicity • The multiplicityparametr specifies the number of elements (nodes) that will be removed or read from an input place during transition firing. • Multiplicity is expressed as a pair of numbers [min,max] or a single symbol (min=max) • A symbol * (equivalent to all elements) can appear in multiplicity specification • A transition will remove (read) from an input sequence at least min elements and at most max elements • If the input sequence contains less then min nodes, the transition is not enabled and can not be fired. • For mul = 4 the transition is not enabled • For mul = * the transition will remove all elements satisfying the predicate [./@id>12] • For mul = 1 the transition will remove exactly one arbitrarily selected element

  16. XQPN nets – execution Execution of XQPN net consists in consecutive firing of enabled transitions Transition firing: • Establishing a binding of input variables • Removing nodes from input places, applying transformations defined as output arcs expressions and adding nodes to the output places

  17. Modeling Web Applications with XQPN Four layers: Model – places representing database View – places representing forms and data displayed in a browser Controller – models scripts, contains transitions and auxiliary places Test Data – places storing data originating from the environment or defined outside the model

  18. XQPN model: Display Goods <goods> <item id='7' category='1'> <name>Mouse</name> <price>10</price><stock>12</stock> </item> <item id='11' category='2'> <name>Notebook</name> <price>499</price><stock>2</stock> </item> <item id="14" category="2"> <name>Other Notebook</name> <price>699</price> <stock>17</stock> </item> <item id='17' category='3'> <name>LCD Screen</name> <price>399</price><stock>8</stock> </item></goods> <vgoods session="421a23cf45a"> <item id="11" category="2"> <name>Notebook</name> <price>499</price> <stock>2</stock> </item> <item id="14" category="2"> <name>Other Notebook</name> <price>699</price> <stock>17</stock> </item> </vgoods> <incategory> <id>1</id> <id>2</id> <id>3</id> <id>4</id> <id>-10</id> </incategory> <insession> <id>ab12fde1734</id> <id>421a23cf45a</id> <id>de3481456d7</id> </insession>

  19. XQPN model: Add To Cart <vcart session="421a23cf45a"> <item id="11"> <name>Notebook</name> <quantity>1</quantity> </item> </vcart> <cart> <cartitem session="ab12fde1734"> <id>7</id> <quantity>2</quantity> </cartitem> <cartitem session="421a23cf45a"> <id>11</id> <quantity>1</quantity> </cartitem> </cart> <vbuyerror> <session>de3481456d7</session> <id>10</id> <quantity>3</quantity> <stock>0</stock> </vbuyerror> <vgoods session="421a23cf45a"> <item id="11" category="2"> <name>Notebook</name> <price>499</price> <stock>2</stock> </item> <item id="14" category="2"> <name>Other Notebook</name> <price>699</price> <stock>17</stock> </item> </vgoods> <inquantity> <num>1</num> <num>2</num> <num>3</num> </inquantity>

  20. Tested system • During the development, the framework has been validated by testing a web application based on web service. • Functionality of an internet shop (logging, searching for goods, adding products to the cart, etc.) • Implemented in C# language on ASP.NET platform

  21. Translates information on transition and variables binding to calls of web application build on the tested web service. A tool for preparing a network specification: the structure and the marking of selected places (Test Data) • Executes transitions in XQPN nets. • Can fire a specified or a randomlyselected transition. • Can run a simulation. • Provides tools for querying the net state (marking). • Equipped with the console (for manual tests and validation of XQPN specification). A tool for testing equality (inclusion) of XML data representing the reached marking in XQPN net and the current state of the tested application (Ouput XML and DB content XML) A module responsible for coordination of the tests Examines the data base and returns its state in XML format Proxy class generated from WSDL web service description modified to log service calls and responses. Architecture of the Framework

  22. The Test Driver sends a request to the XQPN Executormodule to fire an enabled transition • The transition and its binding are transformed to a call to the WebApp by Transition2Web Mapper. • The call to the WebApp propagates through the Proxyand results in the execution of the corresponding Web Service method Initial marking (including data base state is loaded to XQPN executor) • The web service response is caught at the Proxy module. • The changes in the data base are registered by DB Logger. • Both data flows are merged to form Test Result XML TestDriver invokes the Comparator module that checks whether Test Result data are included in the Reached Marking retrieved from XQPN Executor and formulates a verdict: Test Case Result Test execution • The whole process continues until: • A test case fails • There is no enabled marking in XQPN • Other stop criteria are met, e.g. number of executed transitions reaches a fixed value

  23. Conclusion - current development status • Still in prototype phase…. • Modules of the framework are iterativelly modified and validated by adding new functionality to the tested application, preparing XQPN specification and running test cases. • The crucial module: XQPN Executor • Based on Altova XML (at present) • Platform .NET, written in C # • Efficient for small XML data • Narrow COM interface is an obstacle for more efficient implementation • Manipulation of XML documents outside XQuery by slow DOM interface • Based on Saxon-B (developed in paralell) • Java platform, XQJ interface • Less efficient for small documents, superior at large datasets, e.g. >10000 nodes • Enables sofisticated manipulation outside XQuery

  24. Conclusion – future works • Implementation of additional tools, especially for defining mappings between XQPN specification and the tested system. • Developing metrics of a good coverage and tools to analyze them • Passive tests of web applications and web services • Generation of a skeleton of a web application based on a validated XQPN specification

  25. A Framework For Testing Web Services Based On XQPN Petri Nets Thank you

More Related