Executing Gatling load tests from SBT
<p>I wrote a small web service using Spray framework. I can run it using <code>sbt run</code> and then test it in the browser.</p>

<p>Now I wrote a load test using the Gatling framework.</p>

<pre><code>package com.abhi

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class LoadTest extends Simulation {
   val httpConf = http
      .baseURL("http://localhost:8999")
      .acceptHeader("application/json")
      .doNotTrackHeader("1")
      .acceptLanguageHeader("en-US,en;q=0.5")
      .acceptEncodingHeader("gzip, deflate")
      .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0")

   val scn = scenario("BasicSimulation")
      .exec(http("request_1")
      .get("/path1"))
      .pause(5)

   setUp(
      scn.inject(atOnceUsers(10))
   ).protocols(httpConf)
}
</code></pre>

<p>The test is located in folder <code>src/test/scala-2.11</code> and the spray code is in <code>src/main/scala-2.11</code></p>

<p>When I run <code>sbt test</code> it just prints success without either running my web server or running the test defined above. it just prints success in 3 seconds and gets out.</p>

<p>How can I</p>

<ol>
<li>ensure that when I do a <code>sbt test</code> the spray web application is
started </li>
<li>the galing load test is run against the started server</li>
</ol>

<p>Edit: I also tried <code>sbt test scenarios:BasicSimulation</code> and it threw the error</p>

<pre><code>Not a valid key: BasicSimulation
[error] scenarios:BasicSimulation
</code></pre>