One of the really nice things about using DynamoDB to back an application is the ability to write integration tests that have a good test server without trying to mimic DynamoDB yourself.
DynamoDB_Local is available from AWS and is easily incorporated into a Maven build. Take a look through the documentation for running DynamoDB on Your Computer for the parameters available.
The general steps for adding this to your build are:
- Download the DynamoDB Local artifact.
- Reserve a local port for Dynamo to start on.
- Start DynamoDB_Local just before integration tests are run.
- Use the failsafe plugin to run integration tests.
The steps are covered in more technical detail in the pom.xml file below. Adding this to the build is the only thing necessary as this performs all the steps above and tears down the process afterwards.
Advertisements
[…] you have an integration test that requires external resources to be available, like a local DynamoDB server, that test should be skipped rather than fail when the resources aren’t there. In JUnit, this […]