How to Troubleshoot Apps for the Modern Connected Worker
CHOReOS Web Services FISL Conference Brazil 2012
1. ChoreUnit: Testing framework for
Web Services
Felipe Besson, Guilherme Nogueira, Leonardo Leite
{besson, gmaio, leofl}@ime.usp.br
Porto Alegre, July 2nd, 2011
5. Web Services
Message exchange standards (xml)
among systems through Internet (http)
6. Web Services - Applications
● Machine-machine communication
00111100
10111010
10111101
11110000
7. Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
8. Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
Z z z z
z z
z Z
Z
Comprar
9. Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
Z z Service provider z z
z z
z Client Z
Z
Buy
10. Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
● Data access
WS
11. Web Services - Applications
● Machine-machine communication
● Integrate heterogeneous systems
● Business automation
● Data access and creation (colaborative)
WS
20. WS Client with Jax-WS
StoreWSService service = new StoreWSService();
StoreWS store = service.getStoreWSPort();
List<CD> cds = store.searchByGenre("Rock");
24. Stub creation can be a problem
Process:
%$#@ 1. create
stubs
2. add classes to
project
3. understand classes
Developer
Service interface
changed!
25. Problems when testing
● Tests must be almost completely
rewritten
● Problem to integrate different services
● How to do TDD without stubs?
%$#@
26. Our Goals
Make testing web services easy
● Interact with web services without stubs
● Easily validate the operation's responses
● Writing tests before the actual implementation
● Integrate tests and framework to the development
environment
28. Usage (1)
WSClient – dinamic client
// criation
WSClient service = new WSClient (String wsdl);
// Invoking an operation
Item resposta = service.request (String operation,
Item parameters);
29. Usage (2)
Item – recursive structure representing complex
types
<n s: g etP r od u ctB y N am eR esp on se>
<n s:r Ietu rrn xsi:ty p e=”ax26:I tem od u ctB y N am e”, “S occer
tem esp on se = w s.r equ est( “g etP r
”>
<bar cod e>153</ bar cod e>
cleat”);
<br an d >ad id as</ br an d >
<d escr ip tionr>A on se.g etC h ild ( “r etution;>
I tem item = esp cleat</ d escr ip r n ”)
I tem .g etN am e( ) ; => “r etu r n ”
<n am e>S occer cleat</ n ame”) ; => “ax26:I tem ”
I tem .g ettag A ttr ibu te( “xsi:ty p e>
<p r ice>90.0</ p r ice>
<spitem .g etC h ild( </ sp or t>.g etC on ten t( ) ; => “153”
or t>soccer “bar code”)
I tem .g etC h ild( “br an d ”) .g etC on ten t( ) ; => “adid as”
</ n s:rtem .gretC h ild( “descr ip tion ”) .g etC on ten t( ) ; => “A cleat”
I etu n >
</ n s:g etP r od u ctB y N am eR esp on se>
…
33. Next steps
● Implement new features
● REST services support
● Integration test
– Validate messages exchanged
between services
● Experimentation
34. Questions?
This research has received finding from:
More Information: http://ccsl.ime.usp.br/baile/VandV
Repository: https://github.com/choreos/choreos_v-v/