javolution.testing

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » Development » Javolution » javolution.testing 
javolution.testing

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 {@link javolution.testing.TestSuite TestSuite} which is basically a collection of {@link javolution.testing.TestCase TestCase} logically grouped together. (Note: You will find examples of test suites in the javolution.* source directory). Then by running within an appropriate {@link javolution.testing.TestContext TestContext}, the developer can focus on any particular aspect of interest (behavior, performance, memory usage, ...) For example:[code] // Default tests execution, simple validation and logging of the results. new MyTestSuite().run(); // Specialized context measuring execution time (default average time, with minimum time in parenthesis). TimeContext.enter(); try { new MyTestSuite().run(); } finally { TimeContext.exit(); } // Regression tests (no output, AssertionException raised if any test fails). TestContext.enter(TestContext.REGRESSION); // Or TimeContext.REGRESSION for performance regression test. try { new MyTestSuite().run(); } finally { TestContext.exit(); } [/code] Logging/tests contexts do not have to output the results in a text form. Implementations may store results in databases, spreadsheets or show them graphically. For example:[code] // Logs output to console. LogContext.enter(LogContext.CONSOLE); try { new MyTestSuite().run(); } finally { LogContext.exit(); }[/code]

Java Source File NameTypeComment
AssertionException.javaClass This class represents an exception which might be raised when a testing assertion fails (see TestContext.REGRESSION ).
TestCase.javaClass

This class represents a test case which can be used for validation, performance and regression tests.

The structure of a test case is as follow:[code] class MyTestCase extends TestCase { // Prepares data/state in which to run the test. public void prepare() { ...

TestContext.javaClass

This class represents a logging context specialized for testing.

Custom implementations may output results in varied form (e.g.

TestSuite.javaClass

This class represents a collection of TestCase test cases and detailed information about the test being performed.

TimeContext.javaClass

This class represents a TestContext test context specialized for measuring execution time.

TimeContext implementations may perform assertions based upon the execution time.

w_w_w_.j___a__va2s.___com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.