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

标签 spring-boot gradle gatling scala-gatling

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

这是我写的任务:

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.

最佳答案

@ 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目录中生成报告。

关于spring-boot - 用gradle进行加特林特:尽管执行了操作,任务仍未声明任何输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60745559/

相关文章:

android - ClassNotFoundException : kotlin. KotlinNothingValueException 使用带有 build.gradle.kts 的 Android Studio 4.2 Canary 8

android - 带有 Gradle 7 的 AppDistribution Gradle 插件

加特林不在 session 中存储值(value)

scala - 如何在 Galing 中引用 CSV Feeder 中的变量?

java - Spring Boot 中自定义 LdapUserDetailsS​​ervice 始终无法匹配密码

java - 本地开发无法禁用 Spring 配置服务器

logging - 在 Intellij Junit 中配置日志级别 在 gradle 项目中运行配置?

performance-testing - Gatling(性能测试):how to perform task in background every x-minutes

java - 在我的(java spring mvc + mysql应用程序,thymeleaf)中实现spring security后,身份验证发生了一些奇怪的事情

spring-boot - 在spring data mongodb中如何实现分页进行聚合