Jmeter - create an exclusion list of visited pages

48 views Asked by At

I got a project where I perform status change on the transaction and I'd like to put the transaction ID in a sort of exclusion list and at the IfController check if Id is not in that list

-- Get ALL transactions IDs
   -- RegEx Extract Transaction ID
   -- IfController (if(ID != null))
   -- Change Transaction Statushere

What I did was to put JSR223 Post-processor in the "Change transaction Status" with :

if(prev.isSuccessful()){
     var id;
     id = vars.get("id");
     exclusionList = vars.get("exclusionList");
     exclusionList = exclusionList.concat([id]);
     vars.put("exclusionList", exclusionList);};

and a JSR223 Pre-processor in the beginning with:

var exclusionList = [];
vars.put("exclusionList", exclusionList);

So now my test file looks like:

    -- JSR223 Pre-processor (create list, put it in vars)
    -- Get ALL transactions IDs
       -- RegEx Extract Transaction ID
       -- IfController (if(ID != null))
          -- Change Transaction Status
          -- JSR223 Post-processor (update exclusion list with an ID)

But I keep getting exclusionList Not defined error at vars.put("exclusionList", exclusionList);

1

There are 1 answers

0
Ori Marko On BEST ANSWER

First you need to define exclusionList with def as groovy.

Second you need to putObject method in order to add non String variable.

def exclusionList = [];
vars.putObject("exclusionList", exclusionList);

Also for JSR223 Pre-processor check jmeter.log for errors and try to understand the errors or add it to a question.