This section contains the Overview of JUnit Extensions.
Overview of JUnit Extensions
Given below some of the important extensions of JUnit with brief description :
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. This is an excellent way to avoid the myriad of problems that can occur when one test case corrupts the database and causes subsequent tests to fail or exacerbate the damage.
-
DbUnit has the ability to export and import your database data to and from XML datasets.
SQLUnit
SQLUnit is a regression and unit testing harness for testing database stored procedures. An SQLUnit test suite would be written as an XML
file. The SQLUnit harness, which is written in Java, uses the JUnit unit testing framework to convert the XML test specifications to JDBC calls
and compare the results generated from the calls with the specified results.
JUnitEE
-
A JUnit extension for testing Java EE applications.
-
JUnitEE provides a TestRunner which outputs HTML and a servlet which can be used as an entry point to your test cases.
Jakarta Cactus
Cactus is a simple test framework for unit testing server-side Java code (Servlets, EJBs, Tag libs, etc) from the Jakarta Project. 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.
HtmlUnit
A java GUI-Less browser, which allows high-level manipulation of web pages, such as filling forms and clicking links; just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.
HttpUnit
HttpUnit is an open source software testing framework used to perform testing of web sites without the need for a web browser. HttpUnit supports HTML form submission, JavaScript, HTTP basic access authentication, automatic page redirection, and cookies.
HttpUnit is well suited to be used in combination with JUnit, in order to easily write tests that verify the proper behavior of a web site.
XMLUnit
-
XMLUnit provides classes to validate or compare XML files or to assert the value of XPath expressions applied to them.
-
XMLUnit enables JUnit-style assertions to be made about the content and structure of XML.
EasyMock
EasyMock provides Mock Objects for interfaces (and objects through the class extension) by generating them on the fly using Java's proxy mechanism. Due to EasyMock's unique style of recording expectations, most refactorings will not affect the Mock Objects. So EasyMock is a perfect fit for Test-Driven Development.
JExample
A JUnit extension that uses dependencies between test cases to reduce code duplication and improves defect localization.It also helps us to reuse fixtures and to pinpoint failures.
Mockrunner
Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports servlets, filters, tag classes and Struts actions and forms. Furthermore it includes a JDBC, a JMS and a JCA test framework and can be used in conjunction with MockEJB to test EJB based applications.
JWebUnit
-
JWebUnit is a Java-based testing framework for web applications. It wraps existing testing frameworks such as HtmlUnit and Selenium with a unified, simple testing interface to allow you to quickly test the correctness of your web applications.
-
JWebUnit provides a high-level Java API for navigating a web application combined with a set of assertions to verify the application's correctness. This includes navigation via links, form entry and submission, validation of table contents, and other typical business web application features.
[ 0 ] Comments