0

Am new to JMeter. I have extracted my required values from response data using regular expression extractor. Now I need to use these etracted values to select a particular data from the list.

I have few data listed. In these data, few have edit enabled and few data's edit are disabled. I have to instruct JMeter to select data that have edit enabled. there are 3 conditions to have edit enabled which is:

is_final = 1 
is_locked = 0 
status_id = 1

I have extracted these values from response data. But I donot know how to use BeanShell to instruct JMeter to select data that have edit enabled. Please help me on this.

1
  • where is the list? what kind of list? what kind of data do you want jmeter to select?
    – CharlieS
    Commented Oct 20, 2014 at 1:35

2 Answers 2

1

the syntax of the Beanshell script is quite similar to Java. Say, you have a list of elements: ArrayList<element> list and each element has fields:is_final,is_locked,status_id, so you can write a loop to go through all the elemnts in the list like

 for(int i = 0; i < list.size(); i++){
        if(list.get(i).is_final == 1 && list.get(i).is_locked == 0 && list.get(i).status_id == 1){
           return list.get(i);
        }

hope this is helpful to you! about jmeter's introduction on beanshell and beanshell's offifical wiki

0

If you want to use the single values out of Extracted array. First you need to understand these variables are stored as for eg:MYREF_g0,MYREF_g1,MYREF_g2

So if you wanted to extract say status_id in your case which is stored at 3rd array position in ReferenceName say Abc. then refrence variable name should be${Abc_g2}.

Same applies for other values like ${Abc_g0},${Abc_g1}.

Hope this helps.!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.