Testing DropwizardMichał Rutkowski ([email protected])
Challenge
My Service
Dependency Service 3
Dependency Service 2
Dependency Service 1
Will it work?
Assume
ServiceService Client
Teste
d
Before deploying we would like to test
My ServiceMy Service
ClientDependency 2 Client
Dependency 1 Client
Dependency 3 Client
Solution: dropwizard-testing-integration
End-to-end service test as opposed to unit and resource tests:- Allows you to start and stop the dropwizard instance
programmatically- Compatible with DW 0.62- Use it to run integration tests in your build
Example: setup
Example: teardown
Example: tests
How to get it?
https://github.com/yammer/dropwizard-testing-integration
Caveats
• We needed to hack a bit, to reset static state. • Flaky with more than one instance being started at the
same time.• Only tested to work with DW 0.62• Be careful how you pull in dependency clients
Future
• Integrate the functionality into DW• Would be useful if DW had no static state