jmeter初探

it2022-05-05  148

因项目需要,简单了解下性能测试工具。Apache JMeter.

1 加载pom依赖

ApacheJMeter_core,ApacheJMeter_components,ApacheJMeter_http,junit

2 配置jmeter.properties

public static HTTPSamplerProxy createHTTPSamplerProxy() { HeaderManager headerManager = new HeaderManager(); headerManager.setProperty("Content-Type", "multipart/form-data"); HTTPSamplerProxy httpSamplerProxy = new HTTPSamplerProxy(); httpSamplerProxy.addArgument("name", "hhhhhh"); httpSamplerProxy.addArgument("id", "1200"); httpSamplerProxy.setDomain("127.0.0.1"); httpSamplerProxy.setPort(8011); httpSamplerProxy.setPath("/sql/hh"); httpSamplerProxy.setMethod("GET"); httpSamplerProxy.setConnectTimeout("5000"); httpSamplerProxy.setUseKeepAlive(true); httpSamplerProxy.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName()); httpSamplerProxy.setHeaderManager(headerManager); return httpSamplerProxy; }

4 本地启动SpringBoot项目,8011端口,拦截看参数是否传递过去。


最新回复(0)