0
votes

I am trying to set value in beanshell inside "CANCEL ORDER" sampler and then use in sampler request body.

Trying

vars.put("orders",Arrays.toString(orderList.toArray())); and accessing in json request body using ${orders} and its not passing value.

{ "orderIds": ${orders}, "tonce": "${tonce}" }

   POST data:
   {
   "orderIds": ${orders},

enter image description here

1

1 Answers

0
votes
  1. Your "not passing value" doesn't tell anything to us, if your Beanshell script doesn't work as expected first of all you need to check jmeter.log file for any suspicious entries, if your script fails somehow you will be able to see the error message in the log.

  2. It worth checking your orderList variable value using Debug Sampler or printing it to the aforementioned jmeter.log file using log.info() shorthand

  3. Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting as: