Chapter 1. Overview - What is JRunit

JRunit is a project to aid in adding benchmarking to JUnit based test cases as well as providing a framework extension to JUnit to allow for distributed client/server based tests. It is important to note that JRunit is not a replacement for the popular test framework JUnit, but an extention to it allowing for more enterprise focused features.

With regards to client/server based testing, there are certain limitations of JUnit that make it impractical to use out of the box. The biggest limitation is that it was designed to have all tests run within a single process within a single class. It is also designed with the constraint that all tests are atomic and independent of any other code outside the test being run and that the lifecycle for these tests are independent for each test. This is all great for testing low level units of code, but not for client/server scenario tests.

Due to the specific nature of client/server code, there are some extra requirements for testing. The first is that the lifecycle, or state, of the client and server tests can be managed. This is important because will need to make sure that the server is created and initialized before any clients begin their tests which will call on the server and that the server does not shutdown before all the clients have finished their tests. Also need the ability to consolidate the results from all the client and server tests into a single result format. Finally, need to be able to have all this driven from a single point so can be included within an automated test run from a build.

JRunit addresses these issues by allowing multiple test cases, client and server, to be run simultaneously in different processes, but controlled through a central driver. This driver controls the complete lifecycle of all the test cases. Each of the test cases spawned by the driver are run within a harness that is responsible for reporting all the results back to the driver. This driver is itself a TestCase?, so can be run directly from an IDE or ant build as a JUnit test case.

JRunit also allows the addition of benchmark hooks into test code. These benchmark hooks will allow the JRunit framework to collect statistics on how long it takes to execute different sections of code. These statistics can be captured to a number of persistent stores and viewed as immediate results or captured over time to view how performance is impacted over time due to code changes.