Archive for the tag 'junit'

XMLUnit: JUnit and NUnit testing for XML

XMLUnit [1] for Java provides two JUnit extension classes, XMLAssert and XMLTestCase, and a set of supporting classes (e.g. Diff, DetailedDiff, Transform, SimpleXpathEngine, Validator, NodeTest) that allow assertions to be made about:

  • The differences between two pieces of XML
  • The outcome of transforming a piece of XML using XSLT
  • The evaluation of an XPath expression on a piece of XML
  • The validity of a piece of XML
  • Individual nodes in a piece of XML that are exposed by DOM Traversal

XMLUnit for Java can also treat HTML content (even badly-formed HTML) as valid XML to allow these assertions to be made about the content of web pages too.

[1] http://xmlunit.sourceforge.net/

EclEmma: Java code coverage tool for Eclipse

EclEmma [1] is a free Java code coverage tool for Eclipse [2], available under the Eclipse Public License. Internally it is based on the great EMMA Java code coverage tool, trying to adopt EMMA’s philosophy for the Eclipse workbench:

  • Fast develop/test cycle: Launches from within the workbench like JUnit [3] test runs can directly be analyzed for code coverage.
  • Rich coverage analysis: Coverage results are immediately summarized and highlighted in the Java source code editors.
  • Non-invasive: EclEmma does not require modifying your projects or performing any other setup.

The Eclipse integration has its focus on supporting the individual developer in an highly interactive way.

The update site for EclEmma is http://update.eclemma.org/.

See also installation howto.

[1] http://www.eclemma.org
[2] http://www.eclipse.org
[3] http://www.junit.org

JExample: JUnit extension helps to reuse fixtures and to pinpoint failures

JExample [1] introduces producer-consumer relationships to unit-testing. A producer is a test method that yields its unit under test as return value. A consumer is a test method that depends on one or more producers and their return values.

  • Pinpoint failures: JExample skips any test method whose producer has failed.
  • Reuse fixtures: the return value of a producer is injected into its consumers.

It is released unter Common Public License Version 1.0 (CPL).

[1] http://smallwiki.unibe.ch/jexample, http://sourceforge.net/projects/jexample/