相关疑难解决方法(0)

为Gatling负载测试构建可执行JAR

我是Gatling(2.1.2)的新手,想要做一个小型原型项目给同事们展示.

根据快速入门页面,有几种方法可以用Gatling运行模拟:

  1. 将Gatling包解压缩到一个文件夹中,然后将我的模拟文件放到user-files/simulations文件夹中.bin/gatling.sh将编译并运行模拟文件.
  2. 使用gatling-maven-pluginmaven插件执行模拟.
  3. gatling-highcharts-maven-archetype,创建一个项目,并运行Engine类.

我发现了那些问题

对于1,很难为模拟类添加依赖项.我必须弄清楚需要什么罐子并将它们放到lib文件夹中.

对于2,它需要安装maven.

对于3,它只从IDE运行

我只想要一个简单的可执行JAR文件,其中所有依赖项捆绑在一起(我的模拟,加特林和第三方),并从任何机器(如EC2实例)运行它.

有没有办法实现这个目标?

更新1:

我尝试了方法3,但将所有项目文件从test文件夹移动到main,并用于maven-assembly-plugin构建具有依赖项的jar.当我尝试运行该文件时,出现以下错误:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at Engine$.delayedEndpoint$Engine$1(Engine.scala:7)
    at Engine$delayedInit$body.apply(Engine.scala:4)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.App$class.main(App.scala:76)
    at Engine$.main(Engine.scala:4)
    at Engine.main(Engine.scala)
Caused by: java.nio.file.FileSystemNotFoundException
    at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)
    at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
    at java.nio.file.Paths.get(Paths.java:143)
    at io.gatling.core.util.PathHelper$.uri2path(PathHelper.scala:32)
    at IDEPathHelper$.<init>(IDEPathHelper.scala:7)
    at IDEPathHelper$.<clinit>(IDEPathHelper.scala)
    ... 11 more
Run Code Online (Sandbox Code Playgroud)

我想这与Gatling配置有关,但不知道出了什么问题.

java load-testing gatling

14
推荐指数
3
解决办法
1万
查看次数

标签 统计

gatling ×1

java ×1

load-testing ×1