1

Here is the scenario :

20 users with one thread group and 6 driver with other thread group here interlink the thread group with beanshell Assertion with setproperty method so from 20 user is generating 20 pickup id.

So here is the response- {"error":"200","error_description":"7000"}

I'm getting for 20 it is like 7001,7002,7003.....7020 but I am sending this pick up id to next thread group by using ${__property(PickUpId_value)} so here 6 driver accepting the same pick id that is 7020 last one. this the against the functionality how to over come this problem.

Is there any way that ${_property()} store all the generated pick up id and assign different pick up id to all the 6 drivers in next Thread group ? Please help me.

1 Answer 1

2

I would recommend switching to JSR223 Assertion and Groovy language as:

So if use the following Groovy code in the JSR223 Assertion:

def threadName = Thread.currentThread().getName()
threadName = threadName.substring(threadName.lastIndexOf('-') + 1)

def response = new groovy.json.JsonSlurper().parse(prev.getResponseData())
props.put('PickUpId_value_' + threadName, response.error_description)

It will generate the following (or similar) JMeter Properties:

PickUpId_value_1=7000
PickUpId_value_2=7001
PickUpId_value_3=7002
PickUpId_value_4=7003
PickUpId_value_5=7004

So you will be able to refer it using i.e. __threadNum() function like ${__P(PickUpId_value_${__threadNum},)} or any JMeter Variable, for example Counter reference name like ${__P(PickUpId_value_${someCounterValue},)}

6
  • here i am using like this ${__pickUpId_value_${counter},)} but it is not happening. pick up id is not passing inside the request
    – SQA
    Nov 9, 2017 at 10:30
  • it is showing like this "pickupid":""
    – SQA
    Nov 9, 2017 at 10:36
  • Thanks Dmitri T you made my day .....you always helped me to complete my task thanks lot once again
    – SQA
    Nov 9, 2017 at 11:07
  • i just use __counter() function it is working form me
    – SQA
    Nov 9, 2017 at 11:08
  • Hi... Dmitri i asked one more question please help me to sort out that problem
    – SQA
    Nov 13, 2017 at 4:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.