Struts2 documentation describes how to write Unit tests for Struts 2. But how can I actually run these tests once they're written? E.g, normally I would create a new JUNIT test for a class using Eclipse / Netbeans, and then run the tests from within Eclipse / Netbeans.
But, the same can't be done for Struts2 tests, because unless tomcat or another container is running, you can't run struts2 tests, you get errors about missing servlet api and such. (The java ee jars that you normally get only contain interfaces and abstract classes, their implementations only come with a container like tomcat/glassfish).
So, how can I run Struts 2 tests once they are written?
In order to solve missing servlet-apis issue, add the following dependencies to your POM
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<type>jar</type>
<scope>test</scope>
</dependency>