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
I would recommend switching to JSR223 Assertion and Groovy language as:
- Since JMeter 3.1 it is recommended to use JSR223 Test Elements and Groovy for scripting
- Groovy has built-in JSON support so you will be able to parse responses without using any extra test elements or libraries
- Groovy performs much better than Beanshell
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},)}
-
here i am using like this ${__pickUpId_value_${counter},)} but it is not happening. pick up id is not passing inside the requestSQA– SQA2017年11月09日 10:30:30 +00:00Commented Nov 9, 2017 at 10:30
-
it is showing like this "pickupid":""SQA– SQA2017年11月09日 10:36:42 +00:00Commented Nov 9, 2017 at 10:36
-
Thanks Dmitri T you made my day .....you always helped me to complete my task thanks lot once againSQA– SQA2017年11月09日 11:07:55 +00:00Commented Nov 9, 2017 at 11:07
-
i just use __counter() function it is working form meSQA– SQA2017年11月09日 11:08:43 +00:00Commented Nov 9, 2017 at 11:08
-
Hi... Dmitri i asked one more question please help me to sort out that problemSQA– SQA2017年11月13日 04:29:16 +00:00Commented Nov 13, 2017 at 4:29
Explore related questions
See similar questions with these tags.