title: Maven not running Spring Boot tests
body: <p>I have a rest Spring Boot REST API that I want to test. I can run the tests manually in Eclipse (without maven and by running the application as JUnit test) and it runs fine and displays the results, but <code>mvn test</code> does not "work" as you will find out below.</p>
  
  <p>Here is my POM file:</p>
  
  <p>
  http://maven.apache.org/xsd/maven-4.0.0.xsd">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;org.demo&lt;/groupId&gt;
  &lt;artifactId&gt;rest&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;name&gt;UserRegistrationServices&lt;/name&gt;
  &lt;description&gt;RESTful API&lt;/description&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.2.5.RELEASE&lt;/version&gt;
      &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
  
      &lt;!-- Junit --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Spring dependencies --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-mongodb&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;!-- To deploy to external servlet container --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- For Spring Boot testing --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.jayway.restassured&lt;/groupId&gt;
          &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
          &lt;version&gt;2.4.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.jayway.restassured&lt;/groupId&gt;
          &lt;artifactId&gt;json-schema-validator&lt;/artifactId&gt;
          &lt;version&gt;2.4.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- For returning objects as JSON --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
          &lt;version&gt;2.5.4&lt;/version&gt;&lt;!--$NO-MVN-MAN-VER$ --&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-xml-databind&lt;/artifactId&gt;
          &lt;version&gt;0.6.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- To decode Base64 data --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.10&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
          &lt;id&gt;spring-snapshots&lt;/id&gt;
          &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
      &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;repackage&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is the result of <code>mvn test</code>:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO] 
  [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building UserRegistrationServices 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rest ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 1 resource
  [INFO] Copying 0 resource
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rest ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 9 source files to C:\Users\pmandayam\git\UserRegistrationServices\target\classes
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rest ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory C:\Users\pmandayam\git\UserRegistrationServices\src\test\resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rest ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to C:\Users\pmandayam\git\UserRegistrationServices\target\test-classes
  [INFO] 
  [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ rest ---
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 4.768 s
  [INFO] Finished at: 2015-07-28T12:07:41-05:00
  [INFO] Final Memory: 24M/212M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>Here is a segment of my TestController.java class in src/test/java:</p>
  
  <pre><code>@Test
      public void f_findByUsername() {
          // Finding user with username 'user1username'
  
          given().auth().basic("User1username", "Testpassword").when().get(
                  "http://localhost:8080/users/get/ByUsername?username=User1username")
                  .then().assertThat().body("username", is("User1username"));
      }
  </code></pre>
  
  <p>At the top of the TestController class I have these annotations:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringApplicationConfiguration(classes = Application.class)
  @WebAppConfiguration
  /* Tells the embedded Tomcat server to start on a random, open port */
  @IntegrationTest("server.port:0")
  @FixMethodOrder(MethodSorters.NAME_ASCENDING)
  public class TestController {....}
  </code></pre>
  
  <p>I'm not sure whats wrong. I don't have the surefire plugin but its looking for that it seems. </p>