Amira Manai
Amira Manai

Reputation: 2599

Importing with tomcat

Is there a way to tell Tomcat to import a folder when starting so i can use it's content via tomcat . in my case the folder is the src/test/java that contain test classes .

i need to run the test classes using command line

Thank you in advance

Upvotes: 0

Views: 67

Answers (1)

khmarbaise
khmarbaise

Reputation: 97467

The basic thing is to use maven-failsafe-plugin to run the integration tests. In you case this means you need to have a separate maven-module (call it: mod-it) which contains the configuration for the integration tests. The best recommendation i can give is to use the cargo2-maven-plugin to start/deploy etc. Tomcat and deploy the war application within tomcat. Furthermore you should have a layout like this:

project
|-- mod-it
|   `-- pom.xml
|-- mod-war
|   |-- pom.xml
|   `-- src
|       |-- main
|       |   |-- java
|       |   |   `-- com
|       |   |       `-- soebes
|       |   |           `-- wicket
|       |   |               |-- HomePage.java
|       |   |               `-- WicketApplication.java
|       |   |-- resources
|       |   |   |-- com
|       |   |   |   `-- soebes
|       |   |   |       `-- wicket
|       |   |   |           `-- HomePage.html
|       |   |   `-- log4j.properties
|       |   `-- webapp
|       |       `-- WEB-INF
|       |           `-- web.xml
..
`-- pom.xml

The integration tests should be named like *IT.java to get them run by the maven-failsafe-plugin

The best thing is to read this example which contains a complete example with Tomcat and cargo plugin. You can download the full example source incl. pom's etc. here.

Upvotes: 1

Related Questions