用gradle进行加特林特:尽管执行了操作,任务仍未声明任何输出

时间:2020-03-18 18:34:00

标签: spring-boot gradle gatling scala-gatling

我尝试根据本教程在gradle的基础上,在我的Spring Boot项目中设置加特林:http://brokenrhythm.blog/gradle-gatling-springboot-automation

这是我写的任务:

int main(void)
{
    char **x_array;
    size_t x_length;
    x_array = get_string_array(&x_length);

    for (int i=0; (size_t)i < x_length; i++) {
        printf("%s\n", x_array[i]);
        free(x_array[i]);
    }
    free(x_array);

    return 0;
}

但是运行task runGatling(type: JavaExec) { description = 'Test load the Spring Boot web service with Gatling' group = 'Load Test' classpath = sourceSets.test.runtimeClasspath jvmArgs = [ // workaround for https://github.com/gatling/gatling/issues/2689 "-Dgatling.core.directory.binaries=${sourceSets.test.output.classesDirs.toString()}", "-Dlogback.configurationFile=${logbackGatlingConfig()}" ] main = 'io.gatling.app.Gatling' args = [ '--simulation', 'com.mypackage.loadtesting.Simulation', '--results-folder', "${buildDir}/gatling-results", '--binaries-folder', sourceSets.test.output.classesDirs.toString() // ignored because of above bug ] } def logbackGatlingConfig() { return sourceSets.test.resources.find { it.name == 'logback-gatling.xml' }; } 时,出现以下错误:

runGatling

1 个答案:

答案 0 :(得分:0)

@ george-leung是正确的,gradle-plugin解决了我的问题。谢谢:)

这是build.gradle的配置:

plugins {
    id 'scala'
    id "com.github.lkishalmi.gatling" version "3.3.0"
}

dependencies {
    compile 'org.scala-lang:scala-library:2.12.10'
}

模拟文件必须位于目录src/gatling/simulations中。

然后只运行gradlew gatlingRun命令并执行负载测试,默认情况下会在build/reports/gatling目录中生成报告。