Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
11
Help us understand the problem. What is going on with this article?
@k_ui

Gradle から Gatling 発射(バグ回避策付き)

More than 5 years have passed since last update.

$ gradle loadTestGatling による負荷テストが走るようにする。ググると古い情報に当たることが多かったのでメモ。

これを実現した簡単なプロジェクト:

やりかた

build.gradle に Gatling パッケージと、上述したようなタスクを書く。こんな感じ:

build.gradle
dependencies {
    // ...
    testCompile "io.gatling.highcharts:gatling-charts-highcharts:2.1.6"
}

// ...

task loadTest(type: JavaExec) {
    dependsOn testClasses
    description = "load test with Gatling"
    group = "Load Test"
    classpath = sourceSets.test.runtimeClasspath
    jvmArgs = [
        // バグ回避策: https://github.com/gatling/gatling/issues/2689
        // Gatling 2.1.7 になれば不要になるはず
        "-Dgatling.core.directory.binaries=${sourceSets.test.output.classesDir.toString()}",
    ]
    main = "io.gatling.app.Gatling"
    args = [
        "--simulation", "gatring.simulations.FooSimulation",
        "--results-folder", "${buildDir}/gatling-results",
        "--binaries-folder", sourceSets.test.output.classesDir.toString(), // 上述のバグで無視される
        "--bodies-folder", sourceSets.test.resources.srcDirs.toList().first().toString() + "/gatling/bodies",
    ]
}
  • gatring.simulations.FooSimulation にはシナリオが記述されている
  • FooSimulation.scalasrc/test/scala 以下に置く
  • ${buildDir}/gatling-results はレポートの置き場

ただし

Java でアプリケーション作り、Gatling のシナリオを scala で書くと、1つのプロジェクトに Java, Groovy, Scala のコードが存在することになるので少し頭抱える。

シナリオを Groovy or Java で書けるかな?

余談

gradle で scala コードコンパイル時の scala バージョンって指定できないんでしょうか?

11
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
k_ui
ねこほしい

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
11
Help us understand the problem. What is going on with this article?