Spring boot gatlingwithgradle:Task尽管执行了操作,但并没有声明任何输出
根据本教程,我尝试在基于gradle的Spring Boot项目中设置gatling: 以下是我写的任务:Spring boot gatlingwithgradle:Task尽管执行了操作,但并没有声明任何输出,spring-boot,gradle,gatling,scala-gatling,Spring Boot,Gradle,Gatling,Scala Gatling,根据本教程,我尝试在基于gradle的Spring Boot项目中设置gatling: 以下是我写的任务: task runGatling(type: JavaExec) { description = 'Test load the Spring Boot web service with Gatling' group = 'Load Test' classpath = sourceSets.test.runtimeClasspath jvmArgs = [
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
时,我出现以下错误:
> Task :runGatling FAILED
Caching disabled for task ':runGatling' because:
Caching has not been enabled for the task
Task ':runGatling' is not up-to-date because:
Task has not declared any outputs despite executing actions.
@梁乔治是对的,解决了我的问题。谢谢:)
以下是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
目录中生成报告。为什么不使用?它检查后端可用性?是的,它解决了我的问题:)谢谢