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.
1. Create Maven web application
2. Create JPA entity
3. Generate REST service
4. Add unit tests and coverage reporting
5. Add integration tests
6. Continuous Integration
7. Addendum – Running tests from Netbeans