Тест Гатлинга в Blazemeter создает исключение ClassNotFoundException

Я использовал руководство Taurus Gatling для создания простого теста производительности и загрузил файлы yaml и scala в blazemeter. Когда я запускаю тест в blazemeter, результат теста отсутствует, а bzt.log содержит ClassNotFoundException.

Валидатор для yaml говорит, что все в порядке, и я ничего не могу найти, поэтому я потерялся ...

My blazemleter.yaml:

execution:
  - executor: gatling
    scenario: products

    iterations: 15
    concurrency: 3
    ramp-up: 2

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

Мой productSimulation.scala в основном скопирован из их документации:

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)
}

person Laures    schedule 30.09.2020    source источник


Ответы (1)


Узнав, что я могу выполнить файл scala в качестве теста напрямую, если я щелкну файл напрямую, а не yaml, у меня есть лучшие исключения.

В основном я сделал две ошибки:

  1. мои переменные называются t_concurrency, ... в то время как определение выполнения использует другое имя. UPS.
  2. поскольку в gatling 3.x ключевое слово для инъекции находится во время, поэтому правильный код: rampUsers(t_concurrency) during t_rampUp

Теперь все работает.

person Laures    schedule 30.09.2020