I totally agree with you, Ernest. But life is not as simple as you say
I spent some hours taking a look at the various tools that can help us improve our module tests.
Here is the list of the tools that I have found. Maybe it will help someone.
JUnit4
JUnit is a simple, open source framework to write and run repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.
http://sourceforge.net/projects/junit http://www-128.ibm.com/developerworks/java/library/j-junit4.html" TestNG
TestNG is a testing framework designed to simply a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers).
http://testng.org http://testng.org/doc/download.html http://www.ibm.com/developerworks/java/library/j-cq08296 http://www.ibm.com/developerworks/java/library/j-testng" DbUnit
DbUnit is a JUnit extension (also usable with Ant) targeted at database-driven projects that, among other things, puts your database into a known state between test runs.
http://www.dbunit.org http://beust.com/weblog/archives/000316.html TestNG und DbUnit"
EasyMock
EasyMock provides Mock Objects for interfaces in JUnit tests by generating them on the fly using Java's proxy mechanism.
http://www.easymock.org http://www.easymock.org/EasyMock2_4_Documentation.html" JUnitEE
JUnitEE is a simple extension to JUnit which allows standard test cases to be run from within a
J2EE application server.
http://www.junitee.org jMock
JMock is a library that supports test-driven development1 of Java2 code with mock objects3.
Mock objects help you design and test the interactions between the objects in your programs.
http://www.jmock.org jmockit
JMockit Core consists of a single class with a small set of static methods, which allow arbitrary methods and constructors of any other class to be replaced with mock implementations at runtime.
This facility can be used for writing unit or integration tests, enabling the isolation of code under test from other parts of the codebase. This approach is an alternative to the conventional use of ""mock objects"" as provided by tools such as EasyMock and jMock.
https://jmockit.dev.java.net cactus
Cactus is a simple test framework for unit testing server-side java code (
Servlets, EJBs, Tag Libs, Filters, ...).
The intent of Cactus is to lower the cost of writing tests for server-side code. It uses JUnit and extends it.
Cactus implements an in-container strategy, meaning that tests are executed inside the container.
http://jakarta.apache.org/cactus Rmock
RMock 2.0.0 is a Java mock object framework to use with jUnit.
http://rmock.sourceforge.net Cobertura
Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage.
It is based on jcoverage.
http://cobertura.sourceforge.net jcoverage
jcoverage have a suite of tools and technologies designed to improve your coverage and testing productivity. The aim is to reduce the 'code - test - diagnose - fix' cycle. jcoverage enables software projects to save time, money and effort by allowing programmers to monitor progress, catch defects and improve quality.
http://www.jcoverage.com EMMA
EMMA is an open-source toolkit for measuring and reporting Java code coverage. EMMA distinguishes itself from other tools by going after a unique feature combination: support for large-scale enterprise software development while keeping individual developer's work fast and iterative. Every developer on your team can now get code coverage for free and they can get it fast!
http://emma.sourceforge.net HttpUnit
HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links.
http://httpunit.sourceforge.net HtmlUnit
HtmlUnit is a ""browser for Java programs"". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser.
HtmlUnit is not a generic unit testing framework. It is specifically a way to simulate a browser for testing purposes and is intended to be used within another testing framework such as JUnit or TestNG.
http://htmlunit.sourceforge.net Canoo WebTest
Canoo WebTest is a free Open Source tool for automated testing of web applications in a very effective way.
http://webtest.canoo.com/webtest JpdfUnit
JpdfUnit is a framework for testing a generated pdf document with the JUnit test framework so JPdfUnit is a high level api.
http://jpdfunit.sourceforge.net ClassMock
ClassMock is a tool for creating tests for components based on reflection and metadata in Java. It generate classes in runtime with the desired structure to be used in tests.
http://classmock.sourceforge.net