scala – 如何从代码中运行gatling
发布时间:2020-12-16 08:54:15 所属栏目:安全 来源:网络整理
导读:我想从代码中运行Gatling测试.怎么做? 教程只说命令行和sbt. 上下文:我想扩展测试.在后台我有自定义套接字通信,我需要模拟.从模拟中我需要将一些生成的ID传递给Gatling测试.我可以通过我的模拟应用程序使用参数运行它(但我还不知道如何).其他解决方案也是
我想从代码中运行Gatling测试.怎么做?
教程只说命令行和sbt. 上下文:我想扩展测试.在后台我有自定义套接字通信,我需要模拟.从模拟中我需要将一些生成的ID传递给Gatling测试.我可以通过我的模拟应用程序使用参数运行它(但我还不知道如何).其他解决方案也是一个很好的答案. 我可以做一些通过文件和http://gatling.io/docs/2.1.6/cookbook/passing_parameters.html,但它是丑陋.. 也许有办法从scala代码运行sbt任务? 解决方法import io.gatling.app.Gatling import io.gatling.core.config.GatlingPropertiesBuilder object Engine extends App { val props = new GatlingPropertiesBuilder props.simulationClass("your.simulation.class.goes.here") props.dataDirectory("path.to.data.directory") //optional props.resultsDirectory("path.to.results.directory") //optional props.bodiesDirectory("path.to.template.directory") //optional props.binariesDirectory("path.to.binaries.directory") //optional Gatling.fromMap(props.build) } 希望这会有所帮助. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |