Top Banner
Testing Dropwizard Michał Rutkowski ([email protected])
11

Integration testing dropwizard

Nov 28, 2014

Download

Software

An introduction to the dropwizard 0.62 integration testing library.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Integration testing dropwizard

Testing DropwizardMichał Rutkowski ([email protected])

Page 2: Integration testing dropwizard

Challenge

My Service

Dependency Service 3

Dependency Service 2

Dependency Service 1

Will it work?

Page 3: Integration testing dropwizard

Assume

ServiceService Client

Teste

d

Page 4: Integration testing dropwizard

Before deploying we would like to test

My ServiceMy Service

ClientDependency 2 Client

Dependency 1 Client

Dependency 3 Client

Page 5: Integration testing dropwizard

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

Page 6: Integration testing dropwizard

Example: setup

Page 7: Integration testing dropwizard

Example: teardown

Page 8: Integration testing dropwizard

Example: tests

Page 9: Integration testing dropwizard

How to get it?

https://github.com/yammer/dropwizard-testing-integration

Page 10: Integration testing dropwizard

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

Page 11: Integration testing dropwizard

Future

• Integrate the functionality into DW• Would be useful if DW had no static state