Getting Started - Gatling

Follow this guide for a basic example of running a Gatling simulation. For our example we will use a really simple simulation which simply makes an HTTP GET request for http://sample.testable.io/stocks/IBM.

DemoSimulation.scala

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

class DemoSimulation extends Simulation {

  val httpConf = http
    .baseURL("http://sample.testable.io") // Here is the root for all relative URLs
    .userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")

  val scn = scenario("Testable Demo") // A scenario is a chain of requests and pauses
    .exec(http("request_1")
      .get("/stocks/IBM"))

  setUp(scn.inject(atOnceUsers(Integer.getInteger("users", 1))).protocols(httpConf))
}

Start by signing up and creating a new test case using the New Test Case button on the dashboard or Test Case -> New... in the left side panel.

Enter the test case name and then press Next.

Scenario

Select Gatling Simulation as the Scenario type.

Step 2

Click the Add Files (or Create File) button to upload the DemoSimulation.scala file as specified above. For more complex tests you can upload feeders, bodies, CSV files, etc or link this scenario to a version control repository.

Step 3

Click the Smoke Test button in the upper right to run your test plan with 1 user and 1 iteration on a Testable test runner. The output of the run will show up in the Smoke Test Output once it finishes.

And that's it, we've now defined our scenario! Click on the Configuration tab or press the Next button at the bottom to move to the next step.

Configuration

Now that we have the scenario for our test case we need to define a few parameters before we can execute our test:

  1. Load Profile: Select Flat to ramp up to a constant number of concurrent users for the test.
  2. Gatling Instances Per Region: Number of Gatling instances that will execute your Gatling simulation in parallel in each region selected.
  3. Test Runners: Choose the test runners from which to run this test (e.g. on our public shared grid). Each test runner region will execute the number of Gatling instances defined above.
  4. Type: Select Iterations to have each concurrent client execute the entire Gatling simulation sequentially a set number of times regardless of how long it takes. Note that the Gatling simulation can specify multiple loops too which will be honored. Choose Duration if you want each client to continue executing the simulation for a set amount of time (in minutes).

And that's it! Press Start Test and watch the results start to flow in. See the new configuration guide for full details of all configuration options.

For the sake of this example, let's use the following parameters:

Configuration

View Results

Once the test starts executing, Testable will distribute the work out to the selected test runners (e.g. Public Shared Grid in AWS N. Virginia).

Results

In each region, the Testable runners execute 5 Gatling instances 1 time through. Our example test plan will call HTTP GET http://sample.testable.io/stocks/IBM as 5 concurrent users. This means that in total we should get 25 results (5 Testable Gatling instances * 1 Testable iteration * 5 Gatling concurrent users = 25).

You can see various graphs, metrics, and grids in the results. If you click on any resource in the results grid, the charts below will update to be specific to that resource only.

Check out the Gatling guide for more details on running your Gatling tests on the Testable platform.

We also offer integration (Settings -> Integration) with third party tools like New Relic. If you enable integration you can do more in depth analytics on your results there as well.

That's it! Go ahead and try these same steps with your favorite website or API and feel free to contact us with any questions.