JMeter - easily changeable configuration options

I am using JMeter to download the SOAP web service test. The web service exists in several places, such as my local host, dev box, integration unit, production unit, etc.

I use the WebService Request Sampler (SOAP) and set the IP Server Name, Path, and SOAP Action parameters as follows:

Server Name of IP: ${SERVER}
Path: ${PATH}/service
SOAPAction: http://${SERVER}${PATH}service#action

This works great when using the User Defined Variables configuration item. I just change SERVER and PATH to whatever is specific to the location I'm trying to hit. However, this is more of a pain in the ass that I want to deal with. What I was hoping to do (and tried) was to add some If Logic controllers to my thread group and check $ {MODE} (another UDV) and act accordingly by setting up my SERVER and PATH. So I had something like

"${MODE}" == "dev"
"${MODE}" == "local"
"${MODE}" == "production"

If, UDV, SERVER PATH. UDV ( Thread) , , If Controller, false, UDV. , UDV . , User Paramaters , ${SERVER} ${PATH} SOAP , http://${SERVER} ${PATH}, .

? SERVER PATH , , . , , , , , , SOAP-, .

?

+3
2

Sampler BeanShell , Testplan.

" " Testplan. , "", "dev", "local" "production".

Sampler "Bean Shell Sampler" :

if ("dev".equals(vars.get("mode"))) {
 vars.put("server","x.y.z");
}
if ("local".equals(vars.get("mode"))) {
 vars.put("server","127.0.0.1");
}
if ("production".equals(vars.get("mode"))) {
 vars.put("server","10.0.0.10");
}

.

: Bean Shell Sampler. ThreadGroups Simple Controller . .

+4

UDV, .

, , .

, : -)

0

Source: https://habr.com/ru/post/1735314/


All Articles