JMeter enables / disables the HTTP request sampler under certain conditions

I have several samples of HTTP requests that I would like to execute only if a certain condition is met. What I did is add the BeProProcessor BeanShell to the HTTP request sampler with the following code

if (${getTeamName}.equals("Test Team") == true)
{
    HTTPSampler.setEnabled(false);
}

If the value is getTeamName Test Team , then I want to disable this HTTP request sampler, since it should not be executed then. However, it does not seem to be working at the moment.

Is there anyone who knows what I'm doing wrong here, or a suggestion on what I should do?

+4
source share
2 answers

JMeter Performance and Tuning Tips:

, , script ,

: :

  • , : "${getTeamName}" != "Test Team"
    • HTTP-

${getTeamName} Test Team, .

+4

beanshell vars.get("VARNAME")

if (vars.get("getTeamName").equals("Test Team") == true)
{
     sampler.setEnabled(false);
}
+1

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


All Articles