7.6 Automatically running the tests
Prev | 7. Automated Build | Next

## 7.6 Automatically running the tests

Although the application is built, and dependencies produced for separate deployment, the tests are not run as part of that build.

Add (or replace) the following plug-in entry in the `pom.xml` file in the `parent` directory under `start`:

    <plugin>
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-surefire-plugin</artifactId>
    	<configuration>
    		<includes>
    			<include>**/*Tests.java</include>
    		</includes>
    		<excludes>
    			<exclude>**/Abstract*.java</exclude>
    		</excludes>
    		<junitArtifactName>org.junit:com.springsource.org.junit</junitArtifactName>
    		<argLine>-javaagent:${user.home}/.m2/repository/org/springframework/org.springframework.instrument/3.0.0.M3/org.springframework.instrument-3.0.0.M3.jar</argLine>
    	</configuration>
    </plugin>

where the location of the user Maven repository is hard-coded.

Now run `mvn clean install` from the `start` directory. Observe that the tests we constructed before are now run.

Prev | Up | Next
7.5 Adding the dependency plugin | Home | 7.7 Deploying the application