monadWS : A Monad-Based Testing Tool for Web Services College of - - PowerPoint PPT Presentation

monadws a monad based testing tool for web services
SMART_READER_LITE
LIVE PREVIEW

monadWS : A Monad-Based Testing Tool for Web Services College of - - PowerPoint PPT Presentation

monadWS : A Monad-Based Testing Tool for Web Services College of Computer, Nanjing University of Posts and Telecommunications, Nanjing 210003, China j g Yingzhou Zhang, Wei Fu, Changhai Nie Email: zhangyz@njupt.edu.cn A Agenda d About


slide-1
SLIDE 1

monadWS: A Monad-Based Testing Tool for Web Services

College of Computer, Nanjing University of Posts and Telecommunications, Nanjing 210003, China Yingzhou Zhang, Wei Fu, Changhai Nie j g

Email: zhangyz@njupt.edu.cn

slide-2
SLIDE 2

A d

Ab t dWS

Agenda

  • About monadWS
  • Monads Techniques

q

  • The monads in monadWS

HSP d – HSP monad – Gen monad – TestM monad

  • Tool Snapshots
  • Tool Snapshots
  • Conclusion

2

slide-3
SLIDE 3

About monadWS

  • An automatic WS testing tool based on monads techniques

About monadWS

An automatic WS testing tool based on monads techniques

  • monadWS adopts
  • HSP monad[1] for describing WS test cases
  • Gen monad[2] for generating test data automatically,

and and

  • TestM monad for building the whole WS testing.

____________________

[1] HSP (Haskell Server Pages): http://code.google.com/p/hsp/ [2] Cl K H h J Q i kCh k li ht i ht t l f d t ti f [2] Claessen K, Hughes J. QuickCheck: a lightweight tool for random testing of Haskell programs. In Proceedings of the Fifth ACM SIGPLAN international Conference

  • n Functional Programming, New York, 2005: 268~279.
slide-4
SLIDE 4

It f k

WSDL Specification <types/> <binding/> <service/> <portType/>

Its framework

O perations XML Schema SoapActions Services

Data Generation Strategy

URL address

Gen Monads

test cases (XML files) <<Client>> <<Client>> SO AP Generator SO AP Caller request soap HTTP wrap response results expeted response soap Q uickCheck Properties

HSP Monads TestM Monads

Test Reports

slide-5
SLIDE 5

A d

Ab t dWS

Agenda

  • About monadWS
  • Monads Techniques

q

  • The monads in monadWS

HSP d – HSP monad – Gen monad – TestM monad

  • Tool Snapshots
  • Tool Snapshots
  • Conclusion

5

slide-6
SLIDE 6

Monads Intro Monads Intro.

  • A general functional notation

A general functional notation f : a -> b

  • Its monadic version of this notion

f: a -> M b

  • Operations on monad M

return :: a > M a return :: a -> M a bind :: M a -> (a -> M b) -> M b

Therefore, a monad can be thought as a strategy for combining computations gy g p into more complex computations.

2011-6-15

slide-7
SLIDE 7

A d

Ab t dWS

Agenda

  • About monadWS
  • Monads Techniques

q

  • The monads in monadWS

HSP d – HSP monad – Gen monad – TestM monad

  • Tool Snapshots
  • Tool Snapshots
  • Conclusion

7

slide-8
SLIDE 8

HSP Monad: represent TC HSP Monad: represent TC

 represents a WS test case as a SOAP message  can encapsulate any side effects, and lets all XML expressions be computed safely makeTC serv :: InputType -> HSP XML expressions be computed safely makeTC_serv :: InputType > HSP XML

The input type of a service The input type of a service

  • peration (say serv),

such as String, Double …

8

slide-9
SLIDE 9

HSP Monad: represent TC HSP Monad: represent TC

makeTC serv :: InputType -> HSP XML For example: makeTC_serv :: InputType > HSP XML

makeTC_getOffesetUTCTime :: Double -> HSP XML makeTC_getOffesetUTCTime d = <soap:Envelope xmlns:soap=soapURI xmlns:xsd=xsdURI> p p p p <soap:Body> <getOffesetUTCTime xmlns=operURL> <hoursOffset> <% show d %> </hoursOffset> </getOffesetUTCTime> </soap:Body> </soap:Envelope> where soapURI ="http://schemas.xmlsoap.org/soap/envelope/" xsdURI = "http://www.w3.org/2001/XMLSchema" // / /

9

  • perURL = "http://www.Nanonull.com/TimeService/"
slide-10
SLIDE 10

HSP Monad: represent TC HSP Monad: represent TC

makeTC getOffesetUTCTime :: Double -> HSP XML _g makeTC_getOffesetUTCTime d = <soap:Envelope xmlns:soap=soapURI xmlns:xsd=xsdURI> <soap:Body> <getOffesetUTCTime xmlns=operURL> g p <hoursOffset> <% show d %> </hoursOffset> </getOffesetUTCTime> </soap:Body> </soap:Envelope> </soap:Envelope> where soapURI ="http://schemas.xmlsoap.org/soap/envelope/" xsdURI = "http://www.w3.org/2001/XMLSchema"

  • perURL = "http://www.Nanonull.com/TimeService/"
  • perURL

http://www.Nanonull.com/TimeService/

HSP provides interfaces for other computations through the escapes (with “<%” and “%>”)

10

slide-11
SLIDE 11

Gen Monad: generate data Gen Monad: generate data

 automatically generates data for simple types (such as Double, Int, String and so on) class Arbitrary a where arbitrary :: Gen a y

instance Arbitrary String instance Arbitrary Double … instance Arbitrary String … instance Arbitrary Double …

11

slide-12
SLIDE 12

Gen Monad: generate data Gen Monad: generate data

class Arbitrary a where arbitrary :: Gen a

makeTC_getOffesetUTCTime :: Double -> HSP XML

arbitrary :: Gen a

  • general testing method:

Step 1 generate a test value testTCGen :: IO String Step 1. generate a test value Step 2. generate the final test case with the value test CGe :: O St g testTCGen = do d <- generate (arbitrary :: Gen Double) return $ hsp2str (makeTC getOffesetUTCTime d) p ( _g )

12

slide-13
SLIDE 13

Gen Monad: generate data Gen Monad: generate data

makeTC getOffesetUTCTime :: Double -> HSP XML _g testTCGen :: IO String

  • general testing method:

testTCGen :: IO String testTCGen = do d <- generate (arbitrary :: Gen Double) return $ hsp2str (makeTC getOffesetUTCTime d) return $ hsp2str (makeTC_getOffesetUTCTime d)

  • monadic method by liftM : on-the-fly generate

testTCGen2 :: IO String testTCGen2 =

y y g

testTCGen2 liftM (hsp2str. makeTC_getOffesetUTCTime) $ generate (arbitrary :: Gen Double)

13

slide-14
SLIDE 14

Gen Monad: generate data Gen Monad: generate data

 We can easily change the generation strategy through the instances of Arbitrary class. class Arbitrary a where arbitrary :: Gen a y

instance Arbitrary Double where arbitrary = myDoubleGen arbitrary = myDoubleGen myDoubleGen :: Gen Double myStringGen = suchThat arbitrary guard myStringGen suchThat arbitrary guard where guard a = (a > 0) && (a < 1000) || elem a [-1, 0, 9999]

14

|| [ , , ]

slide-15
SLIDE 15

TestM Monad: t

ti d

TestM Monad: testing as a monad

 type TestM a  processes WS testing as the following TestM monad:

Coalgebraic monad

yp = CoAlgMonadT (EnvT TestEnv

g for WS computing

Environment monad for t ti i t

(StateT TestState HSP )) a

testing environment (eg. Schema type information, test cases files)

)) a

State monad for testing states (eg. executing time, testing results)

15

slide-16
SLIDE 16

CPU Time Results

  • f Autogeneration

g Test Cases for TimeService Execution Time of the Execution Time of the SOAP Messages of getOffesetUTCTime in TimeService

slide-17
SLIDE 17

Comparison of WSTester with Other Test Tools for Web Services Comparison of WSTester with Other Test Tools for Web Services

slide-18
SLIDE 18

A d

Ab t dWS

Agenda

  • About monadWS
  • Monads Techniques

q

  • The monads in monadWS

HSP d – HSP monad – Gen monad – TestM monad

  • Tool Snapshots
  • Tool Snapshots
  • Conclusion

18

slide-19
SLIDE 19

S h t f t l dWS Snapshots of our tool monadWS

slide-20
SLIDE 20

Snapshots of our tool monadWS

slide-21
SLIDE 21

Snapshots of our tool monadWS

slide-22
SLIDE 22

A d

Ab t dWS

Agenda

  • About monadWS
  • Monads Techniques

q

  • The monads in monadWS

HSP d – HSP monad – Gen monad – TestM monad

  • Tool Snapshots
  • Tool Snapshots
  • Conclusion

22

slide-23
SLIDE 23

C l i

b i fl i t d d b d t ti

Conclusion

  • briefly introduce our monad-based testing

tool, monadWS

  • To automatically test web services.

dWS d l t d t h l

  • monadWS can use monads related to help

– WS test case representation, – test data autogeneration, and – test auto-execution. test auto execution.

23

slide-24
SLIDE 24

C l i

dWS d l t d t h l

Conclusion

  • monadWS can use monads related to help

– WS test case representation, – test data autogeneration, and – test auto-execution – test auto-execution.

  • Future work

– More comparisons with existing tools – Use more data-generation strategy g gy – Apply to WS composition (with BPEL)

24

slide-25
SLIDE 25