title: spring-boot integration testing using rest-assured
body: <p>I have been struggling with the issue of starting the H2 db in my tests. This is how the tests are annotated -</p>
  
  <pre><code>  @SpringApplicationConfiguration(classes = ServiceApplication.class)
  @WebAppConfiguration
  @IntegrationTest("server.port:8084")
  @PropertySource("test:application.properties")
  public class testSerivce{
  //test scenario
  }
  </code></pre>
  
  <p>The in memory db H2 is used and this is how its setup in application property file -</p>
  
  <pre><code>dataSource.driverClassName=org.h2.Driver
  dataSource.url=jdbc:h2:tcp://localhost:59000/./target/service-db;MODE=Oracle;IGNORECASE=TRUE;IFEXISTS=TRUE
  dataSource.username=sa
  dataSource.password=sa
  dataSource.maxActive=2
  dataSource.initialSize=1
  dataSource.maxIdle=1
  </code></pre>
  
  <p>When I right click and run the tests the H2 db is not getting setup with the service and the tests are not able to connect with database and failing.</p>
  
  <p>Whereas when I run the tests using the maven profile,as thy are running in teamcity everything works and the tests work but it runs all the 10tests .</p>
  
  <p>What should I do? I am stuck at this issue for many days. Which annotation should I use or how to setup the H2 setup so that they also run with the service.</p>