JUnit Plugin

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

This plugin provides a base StrutsTestCase class that can subclassed for tests that work on Struts 2 components. It is used within Struts 2 itself to test core framework components and many bundled plugins. The class StrutsSpringTestCase is also provided, to support testing of actions that use Spring as the object factory.

Tip

See Testing Actions for more details

Info

This plugin is only available with Struts 2.1.1 or later

Features

  • Base test class that starts up a full Struts 2 instance
  • Great for testing how configuration is loaded and Struts 2 components are used

...

Code Block
langxml
<dependency>
  <groupId>org.apache.struts</groupId>
  <artifactId>struts2-junit-plugin</artifactId>
  <version>STRUTS_2_VERSION</version>
  <scope>test</scope>
</dependency>

if you are using Spring, also add:

Code Block
xml

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-spring-plugin</artifactId>
    <version>STRUTS_2_VERSION</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.0</version>
    <scope>test</scope>
</dependency>

If you are not using Maven 2 to build and test your code, ensure the plugin jar and its dependencies (spring-mock and junit) are in the testing classpath.

...