代码之家  ›  专栏  ›  技术社区  ›  Romain R.

gatlingwithgradle:Task尽管执行了操作,但并没有声明任何输出

  •  0
  • Romain R.  · 技术社区  · 6 年前

    根据本教程,我尝试在基于gradle的Spring Boot项目中设置gatling: 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.
    
    0 回复  |  直到 6 年前
        1
  •  1
  •   Romain R.    6 年前

    @梁振英是对的,, 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 默认情况下,目录。

    推荐文章