Unit & Integration Testing REST Services
This posting provides a potted history of the development of a 'Hello Web World' web application. It focuses on the ability to automatically build, unit and integration test the application's REST services.
I have developed desktop utilities previously, where I've used the combination of TDD and Presenter-First to write and test them. I wasn't sure how, or even if, this could be translated to web application development. Some of the results of that learning experience are presented over the next few pages.
Example code is located on Github.
There were minimal requirements for the application and development environment but, because of the exploratory and personal nature of the project, they were also fairly fluid. Nevertheless, roughly they comprised the following:
Maven based – only because that's what I have been used to; Server-side to provide REST API services (another aspect of the learning experience); Unit tests to be non-container based; Integration tests to use a container, but the test code itself should not be container dependent; Project must be able to be built, unit and integration tested within a CI environment (Jenkins).
The facilities and functionality of the Netbeans IDE (my IDE of preference) drove the example, which means Netbeans generated code first and then the tests were written. As a result it is not a pure test-driven example.
Over the next few pages I'll guide you through the development but focus on areas around the test or the development environment configuration.
Posted: September 04, 2013