Apr 14, 2011

Simple Integration test with JUnit Rules

Rules were introduced in JUnit 4.7 release. The short description is following:
The @Rule annotation allows you to annotate a public field in your test class, which is of type MethodRule. This binding will intercept test method calls like an AOP framework would do and redefine the execution, skip it, or do anything else.
Basically Rules is a way to avoid implementing of a custom test runner. In addition this approach gives more flexibility. You can implement your custom behaviour as a number of different rules and apply them to your test classes in different combinations.

My task was to create simple integration testing framework. Here are the most prominent requirements:
  • Generate and dynamically update configuration of the server (httpd)
  • Restart server when it is necessary
  • Provide exhaustive information in case of test failure (environment, server and modules configurations, request details, response details

Apr 6, 2011


Some applications I have worked on provide visualization capabilities. Here are several examples of them.