Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package javolution.testing

Provides classes and interfaces to facilitate all aspects of testing including unit tests, performance, regression, etc.

See:
Description

Class Summary
JUnitContext | This class represents a test context forwarding events to the JUnit framework (e.g. asserts).
TestCase | This class represents a test case which can be used for validation, performance and regression tests.
TestContext | This class represents a logging context specialized for testing.
TestSuite | This class represents a grouping of potentially `parallelizable` `test cases`.
TimeContext | This class represents a `test context` specialized for measuring execution time.

Exception Summary
AssertionException | This class represents an exception which might be raised when a testing assertion fails (see `TestContext.REGRESSION`).
ExecutionException | This class represents an unexpected exception which might be raised during test execution.

## Package javolution.testing Description

Provides classes and interfaces to facilitate all aspects of testing including unit tests, performance, regression, etc.

Too often unit tests focus on one aspect: "Validation". But although a code modification might not break your application; it may very well impact the performance significantly (for the better or the worst). External elements (JVM, O/S, memory available, runtime options) are also likely to affect performance. It is therefore important to not only be able to measure the performance but also to detect automatically (regression tests) when any change you make in your code or runtime environment breaks your timing assumptions.

This test framework addresses not only the validation aspect of testing but performance and regression as well.

In a normal situation, the developer creates a `TestSuite` which is basically a collection of `TestCase` logically grouped together. (Note: You will find examples of test suites in the `javolution.*` source directory). Then by running within an appropriate `TestContext`, the developer can focus on any particular aspect of interest (behavior, performance, memory usage, ...) ``

        // Default context (validation).
        TextContext.enter();
        try {
            TestContext.run(myTestSuite);
            TestContext.run(myTestSuite.tests().get(3)); // Runs individual test case.
            ...
        } finally {
            TestContext.exit(); // Prints test result statistics.
        }

        // Time context (measures execution time)
        TimeContext.enter();
        try {
            TestContext.run(myTestSuite);
            ...
        } finally {
            TimeContext.exit();
        }

        // Regression tests (no output, AssertionException raised if any test fails).
        TestContext.enter(TestContext.REGRESSION); // Or TimeContext.REGRESSION for performance based regression.
        try {
            TestContext.run(myTestSuite);
            ...
        } finally {
            TestContext.exit();
        }

Logging/tests contexts do not have to output test results in a text form. Implementations may store results in databases, spreadsheets or show them graphically (IDE plugin). `

        // Logs output to console.
        TestContext.enter(TestContext.LogContext.CONSOLE);
        try {
            TestContext.run(myTestSuite);
            ...
        } finally {
            LogContext.exit();
        }

`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

Copyright © 2005 - 2009 Javolution.