1

I am very new to Jmeter. In my application I have two scenarios.

  • 1. Create: Here we book a hotel room. After booking application returns a transaction ID.
  • 2. Cancel: We need to pass the transaction Id to the application to cancel booking.

I want to test with jmeter in such a way that after a create call is made, the cancel call of the respective create is called with the generated transaction ID automatically.

Don't have any clue how to do this. Application is written using spring, REST web service. There is one BeanShell Preprocessor in my existing .jmx file. Using that jmx file I call the create & cancel service individually.

kryger
  • 12,906
  • 8
  • 44
  • 65
Sumit
  • 856
  • 5
  • 18
  • 38

2 Answers2

1

Normally you can use a variable to store a string and use it later on, however it is not possible to pass a variable from one thread to another. To do this you need to use a property: this site explains how.

Of course if you need to save a lot of transaction ID's it might make more sense to have the first thread group store them in a csv file and have the second one read them from the file. Have a look at the CSV Data Set Config.

1

Create: Here we book a hotel room. After booking application returns a transaction ID. User regular expression extractor to extract transaction Id from it and store it in a variable. Provide the name of the parameter you get in response in regular Expression text field Refer image Here it will extract transactionId from the response of create and stores it in transactionID variable.

Cancel: We need to pass the transaction Id to the application to cancel booking. Provide the variable name in which transactionId is stored to as the parameter value of cancel request. Refer image

GreyndBlue
  • 331
  • 1
  • 2
  • 11
  • I need to save a lot of transaction Ids. Is it possible to save the transaction Id to CSV file after extracting them using regular expression extractor? @Sumukh Thej – Sumit Jul 19 '16 at 12:43
  • 1
    I guess it can be done using the following post: http://stackoverflow.com/questions/8352281/write-extracted-data-to-a-file-using-jmeter – Sumit Jul 19 '16 at 12:45