我尝试根据本教程在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
答案 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
目录中生成报告。