9. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
outline
!3
testing and us
how we do it today
how we could be doing it
10. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
outline
!3
testing and us
how we do it today
how we could be doing it
our work
11. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
outline
!3
testing and us
how we do it today
how we could be doing it
our work
...see also MyContainer.pdf
14. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
impressions
!4
we don’t test enough much
whatever the scope
do we
?
unit, integration, system.
15. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
impressions
!4
we don’t test enough much
whatever the style
whatever the scope
do we
?
unit, integration, system.
classic or TDD.
16. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
impressions
!4
we don’t test enough much
despite strong evidence
whatever the style
whatever the scope
do we
?
unit, integration, system.
classic or TDD.
10 years of it
?
17. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
impressions
!4
we don’t test enough much
whatever we do, it’s not automated
way off modern CI practices.
18. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
impressions
!4
we don’t test enough much
whatever we do, it’s not automated
we’re years behind here.
way off modern CI practices.
21. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
unit testing
!5
unit testing
why so little
?
blame partly on technologies
including gCore.
22. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
unit testing
!5
unit testing
why so little
?
blame partly on technologies
including gCore.
could overcome in design
but haven’t.
23. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
unit testing
!5
unit testing
why so little
?
blame partly on technologies
including gCore.
could overcome in design
but haven’t.
we’re still to acknowledge value
pursuing requires “education”.
25. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
in-‐‑‒container testing
!6
most components are managed
most clients are remote.
26. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
in-‐‑‒container testing
!6
most components are managed
most clients are remote.
must look beyond unit tests
test component integration.
27. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
in-‐‑‒container testing
!6
most components are managed
most clients are remote.
must look beyond unit tests
test component integration.
first stop is “in-container testing”
integration with gCore, with clients.
28. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
in-‐‑‒container testing
!6
most components are managed
most clients are remote.
must look beyond unit tests
test component integration.
first stop is “in-container testing”
integration with gCore, with clients.
place to answer key questions
about functionality, protocol, lifecycle, state, publication, scope,
performance, load...
30. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
system testing
!7
for more answers, system testing
integrate with other services.
31. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
system testing
!7
for more answers, system testing
integrate with other services.
the hell of our “dev” infras
must solve, maybe not as first step though.
32. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
system testing
!7
for more answers, system testing
integrate with other services.
the hell of our “dev” infras
must solve, maybe not as first step though.
1
: catch bugs earlier
first scope where we can observe them.
33. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
system testing
!7
for more answers, system testing
integrate with other services.
the hell of our “dev” infras
must solve, maybe not as first step though.
1
: catch bugs earlier
first scope where we can observe them.
2
: solutions will generalise
some ideas, premature still.
38. www.d4science.eu
introducing my-container
14 September 2011, Sophia Antipolis (France)
introducing my-container
!8
making the point
easier
harder
...the less bugs we need to
catch here...
...or risk to miss altogether.
43. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
we write “test clients”, in the IDE.
44. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
build and deploy service
typically from console.
45. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
launch container in its own JVM.
typically from console.
46. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
launch clients in their own JVM
often from console.
localhost/ LAN
/ WAN
47. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
localhost/ LAN
/ WAN
observe....
48. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
localhost/ LAN
/ WAN
fix, redeploy, repeat.
49. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
localhost/ LAN
/ WAN
and again at each change, all clients.
50. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!9
status quo
main( ) {…}
localhost/ LAN
/ WAN
yeah, right...
52. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
problems
!10
not reproducible.
problems with the tests
hard to share.
53. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
problems
!10
not reproducible.
problems with the tests
hard to share.
problems with testing
slower than it could be.
less frequent than it should be.
never part of build processes.
58. www.d4science.eu
introducing my-container
separate lives
!11
tests and container
: different lifetimes
same container, many tests and services.
contextual dependencies
outcome depends on state, env., config.
works today
at least for me.
again, contextual dependencies
vars, params, files...
59. www.d4science.eu
introducing my-container
separate lives
!11
tests and container
: different lifetimes
same container, many tests and services.
contextual dependencies
outcome depends on state, env., config.
works today
at least for me.
again, contextual dependencies
vars, params, files...
it’s my test!
your changes will be tested, late.
62. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
the lost seconds
!12
maintenance galore
sync and switch
: two JVMs, one IDE, one console.
63. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
the lost seconds
!12
maintenance galore
sync and switch
: two JVMs, one IDE, one console.
deploy...start...stop (repeat)
even for a one-line change.
in a slower, over-specified container.
64. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
the lost seconds
!12
maintenance galore
sync and switch
: two JVMs, one IDE, one console.
deploy...start...stop (repeat)
even for a one-line change.
in a slower, over-specified container.
it’s a turn-off
less tests _ later feedback _ harder fixes (or more bugs).
69. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
!13
how about...
a single environment
to control it all.
@test
73. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
what does it take?
!14
an embedded container
configured, started, stopped from the test.
one classpath: no build, code is “live”.
74. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
what does it take?
!14
an embedded container
configured, started, stopped from the test.
one classpath: no build, code is “live”.
embedded deployments
defined and carried out from the test.
WSDLs, config, aux libs, services...
76. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
what does it give?
!15
the back-end is a white box
gain access to server-side components.
77. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
what does it give?
!15
the back-end is a white box
gain access to server-side components.
contexts, port-types, homes, ghn...
78. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
what does it give?
!15
the back-end is a white box
gain access to server-side components.
contexts, port-types, homes, ghn...
can “assert” about their state.
79. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
what does it give?
!15
the back-end is a white box
gain access to server-side components.
contexts, port-types, homes, ghn...
encourages “testable designs”
can “assert” about their state.
e.g. design to inject dependencies.
e.g. design to mock remote interactions.
Unit Testing techniques apply.
83. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
our work
!16
embed Globus
it wasn’t born to.
model Gars in code
they weren’t meant to be.
84. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
our work
!16
embed Globus
it wasn’t born to.
model Gars in code
they weren’t meant to be.
extend Junit, pursue DI
to make for clean tests.
85. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
our work
!16
embed Globus
it wasn’t born to.
model Gars in code
they weren’t meant to be.
extend Junit, pursue DI
to make for clean tests.
integrated with Ant and Maven
to achieve automation.
86. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
our work
!16
a friendly and dedicated container
my-container
88. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
89. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
we fed it a tiny one
50kb tarball, 0.5mb on disk
.
90. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
we fed it a tiny one
50kb tarball, 0.5mb on disk
.
empty
embedded storage
build support
91. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
we fed it a tiny one
50kb tarball, 0.5mb on disk
.
available on Etics and Maven
for manual or automated donwload.
92. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
we fed it a tiny one
50kb tarball, 0.5mb on disk
.
available on Etics and Maven
for manual or automated donwload.
93. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
we fed it a tiny one
50kb tarball, 0.5mb on disk
.
available on Etics and Maven
for manual or automated donwload.
handle as “test resource”
exclude from version control.
94. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
distribution
!17
Globus cannot live only in memory
it demands an installation.
we fed it a tiny one
50kb tarball, 0.5mb on disk
.
available on Etics and Maven
for manual or automated donwload.
handle as “test resource”
exclude from version control.
96. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
the Api of my-container
controls and acts upon the distribution.
97. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
available on Etics and Nexus
the Api of my-container
controls and acts upon the distribution.
98. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
available on Etics and Nexus
the Api of my-container
controls and acts upon the distribution.
99. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
available on Etics and Nexus
the Api of my-container
controls and acts upon the distribution.
handle as test library
embed or point to.
100. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
available on Etics and Nexus
the Api of my-container
controls and acts upon the distribution.
handle as test library
embed or point to.
101. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
available on Etics and Nexus
the Api of my-container
controls and acts upon the distribution.
handle as test library
embed or point to.
low-level usage mode
explicit interaction with Api.
102. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
runtime library
!18
available on Etics and Nexus
the Api of my-container
controls and acts upon the distribution.
handle as test library
embed or point to.
low-level usage mode
explicit interaction with Api.
high-level usage mode
annotation-drive. recommended.
104. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
low-‐‑‒level steps
!19
1
: instantiate MyContainer
configure the distribution, including deployments.
105. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
low-‐‑‒level steps
!19
1
: instantiate MyContainer
configure the distribution, including deployments.
2
: start() the instance
start Globus.
block until CERTIFIED/FAILED/DOWN...or timeout
106. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
low-‐‑‒level steps
!19
1
: instantiate MyContainer
configure the distribution, including deployments.
2
: start() the instance
start Globus.
block until CERTIFIED/FAILED/DOWN...or timeout
3
: write the test proper
interact with instance, if necessary.
107. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
low-‐‑‒level steps
!19
1
: instantiate MyContainer
configure the distribution, including deployments.
2
: start() the instance
start Globus.
block until CERTIFIED/FAILED/DOWN...or timeout
3
: write the test proper
interact with instance, if necessary.
4
: stop() the instance
stop Globus and clean up.
112. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
on logging
!21
loaded at MyContainer instantiation
a convenience
113. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
on logging
!21
loaded at MyContainer instantiation
a convenience
114. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
on logging
!21
loaded at MyContainer instantiation
a convenience
118. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
deployments
!23
1
: instantiate Gar
a model of the deployment unit in Globus.
119. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
deployments
!23
1
: instantiate Gar
a model of the deployment unit in Globus.
2
: add service resources to instance
interfaces, WSDLs, schemas, configuration, libraries, ...
wont’ need to add service code
!
120. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
deployments
!23
1
: instantiate Gar
a model of the deployment unit in Globus.
2
: add service resources to instance
interfaces, WSDLs, schemas, configuration, libraries, ...
3
: repeat for other Gars
if necessary.
wont’ need to add service code
!
121. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
deployments
!23
1
: instantiate Gar
a model of the deployment unit in Globus.
2
: add service resources to instance
interfaces, WSDLs, schemas, configuration, libraries, ...
3
: repeat for other Gars
if necessary.
4
: pass instances to MyContainer
at creation time.
wont’ need to add service code
!
129. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
Gar API
!24
wraps an
existing Gar file
one file
at the time
137. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test isolation and performance
!26
the promise of a clean start()
default config, clean storage, no old deployments.
138. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test isolation and performance
!26
the promise of a clean start()
for our inspection...and to avoid unncessary deployments.
default config, clean storage, no old deployments.
the advantage of a dirty stop()
139. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test isolation and performance
!26
the promise of a clean start()
for our inspection...and to avoid unncessary deployments.
default config, clean storage, no old deployments.
the advantage of a dirty stop()
Gars as old as their newest resource.
redeployed only when newer
if it ain’t broke...don’t redeploy it
140. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test isolation and performance
!26
the promise of a clean start()
for our inspection...and to avoid unncessary deployments.
default config, clean storage, no old deployments.
the advantage of a dirty stop()
141. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test isolation and performance
!26
the promise of a clean start()
for our inspection...and to avoid unncessary deployments.
default config, clean storage, no old deployments.
the advantage of a dirty stop()
less than 2 secs, with no deployment
clean is fast
142. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test isolation and performance
!26
the promise of a clean start()
for our inspection...and to avoid unncessary deployments.
default config, clean storage, no old deployments.
the advantage of a dirty stop()
less than 2 secs, with no deployment
why not a container per test
?
performance trade-off.
risky:
our technologies use globals!
clean is fast
144. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
annotation-‐‑‒driven tests
!27
Api idioms often standard.
create, start(), stop(), endpoint(), porttype(),...
145. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
annotation-‐‑‒driven tests
!27
Api idioms often standard.
create, start(), stop(), endpoint(), porttype(),...
146. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
annotation-‐‑‒driven tests
!27
Api idioms often standard.
create, start(), stop(), endpoint(), porttype(),...
avoid boilerplate
with JUnit runners and DI.
147. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
annotation-‐‑‒driven tests
!27
JUnit extension
(brokers interaction with the container)
runner injects on
demand
runner pulls
on demand
148. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
annotation-‐‑‒driven tests
!27
factor out in
test utilities
user service
constants
150. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test automation
!28
matter of build integration
hence depends on build system.
151. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test automation
!28
matter of build integration
hence depends on build system.
automate download
a one-off operation.
152. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test automation
!28
matter of build integration
hence depends on build system.
automate download
a one-off operation.
compile and execute tests
as soon as service itself is compiled.
153. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
test automation
!28
matter of build integration
hence depends on build system.
automate download
a one-off operation.
compile and execute tests
as soon as service itself is compiled.
illustrate Ant case
Maven simpler still.
161. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
conclusions
!30
changes debugging practices
significantly so.
finally enables automation
from Etics to future CI scenarios.
162. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
conclusions
!30
changes debugging practices
significantly so.
finally enables automation
from Etics to future CI scenarios.
available now
full support for up-takers.
163. www.d4science.eu
14 September 2011, Sophia Antipolis (France)
introducing my-container
conclusions
!30
changes debugging practices
significantly so.
finally enables automation
from Etics to future CI scenarios.
available now
full support for up-takers.
yet to be explored
exact scope for white-box testing.
foundations for other “mocking” tools.