我可以在加特林中使用自定义安装方法吗 [英] Can I have a custom Setup method in gatling

查看:74
本文介绍了我可以在加特林中使用自定义安装方法吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想拥有一种自定义安装方法,例如用于与Web服务对话并获取初始值的测试.我可以只在一次模拟中运行一次吗?

I want to have a custom setup method like for a test where i talk to a webservice and get initial values. Can i do this in gatling?I only want to run this once per simulation.

推荐答案

您可以使用之前钩子,以在运行模拟之前执行任何自定义代码.请注意,您不能在那里使用Gatling的DSL.但是,您可以使用加特林附带的从java.net.UrlConnectionAsyncHttpClient的任何Java HTTP客户端.

You can use the before hook to perform any custom code before running the simulation. Note that you can't use Gatling's DSL in there. But you can use whatever Java HTTP client you want, from java.net.UrlConnection to AsyncHttpClient that Gatling ships.

这篇关于我可以在加特林中使用自定义安装方法吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆