Gatling Test in Blazemeter creates ClassNotFoundException

207 views Asked by At

I used the Taurus Gatling guide to create a simple performance test and uploaded the yaml and scala file to blazemeter. When i start the test in blazemeter there is no test result and the bzt.log contains a ClassNotFoundException.

The validator for the yaml says its fine and i can't find anything so I'm lost...

My blazemleter.yaml:

execution:
  - executor: gatling
    scenario: products

    iterations: 15
    concurrency: 3
    ramp-up: 2

scenarios:
  products:
    script: productSimulation.scala
    simulation: test.productSimulation

My productSimulation.scala is mostly copied from their documentation:

package test

import io.gatling.core.Predef._
import io.gatling.http.Predef._

class productSimulation extends Simulation {
    // parse load profile from Taurus
    val t_iterations = Integer.getInteger("iterations", 100).toInt
    val t_concurrency = Integer.getInteger("concurrency", 10).toInt
    val t_rampUp = Integer.getInteger("ramp-up", 1).toInt
    val t_holdFor = Integer.getInteger("hold-for", 60).toInt
    val t_throughput = Integer.getInteger("throughput", 100).toInt
    val httpConf = http.baseURL("https://mydomain/")

    val header = Map(
        "Content-Type" -> """application/x-www-form-urlencoded""")

    val sessionHeaders = Map("Authorization" -> "Bearer ${access_token}",
        "Content-Type" -> "application/json")

    // 'forever' means each thread will execute scenario until
    // duration limit is reached
    val loopScenario = scenario("products").forever() {
        // auth
        exec(http("POST OAuth Req")
            .post("https://oauth-provider")
            .formParam("client_secret", "...")
            .formParam("client_id", "...")
            .formParam("grant_type", "client_credentials")
            .headers(header)
            .check(status.is(200))
            .check(jsonPath("$.access_token").exists
                .saveAs("access_token")))
            // read products
            .exec(http("products")
                .get("/products")
                .queryParam("limit", 200)
                .headers(sessionHeaders))
    }

    val execution = loopScenario
        .inject(rampUsers(concurrency) over rampUp) // during for gatling 3.x
        .protocols(httpConf)

    setUp(execution).maxDuration(rampUp + holdFor)
}
1

There are 1 answers

0
Laures On BEST ANSWER

After learning that i can execute the scala file as a test directly if i click the file directly and not the yaml i got better exceptions.

Basicly i made two mistakes:

  1. my variables are named t_concurrency, ... while the execution definition uses a different name. ups.
  2. since gatling 3.x the keyword for the inject is during, so the correct code is: rampUsers(t_concurrency) during t_rampUp

Now everything works.