0

I have a request that is being sent as a POST method, when the request comes back I need to extract the order_id and run the next transaction using the extracted order_id. My implementation is currently just returning a value of "0" when it should be the 15 character order_id. How do I extract the string from Jmeter?

Response in the body:

response_code=2 response_code_text=Missing required request field: Order ID. time_stamp=1479849486545 retry_recommended=false secondary_response_code=0 order_id=356005935614233 capture_reference_id=1 iso_code= bank_approval_code= bank_transaction_id= batch_id= avs_code= credit_card_verification_response= reference_id=1 bin= retrieval_reference_number= payer_identifier= system_trace_number= captured_amount=0.00 emv_data= bank_response_code=

My Implementation

2 Answers 2

1

Looking into "RegExp Tester" window of the View Results Tree listener and using your response exactly as it appears at the page I would recommend using the following Regular Expression:

order_id=(\d+)

Demo:

JMeter Regular Expression Extractor Demo

Check out Regular Expressions chapter of JMeter User Manual for entry level information on Regular Expressions.

Just in case your response is malformed, I would recommend using the same approach to test your Regular Expressions against real server response. See How to Debug your Apache JMeter Script article for details.

1
  • The expression statement works like a charm, my issue is that my script isn't assigning the value to the variable order_id.
    – DEnumber50
    Nov 23, 2016 at 16:12
0

Based on what I see from your screen shot and description, change the "field to check" option to body and try the following regular expression:

order_id=(.*) capture_reference_id
1
  • this solution didn't work for me, my order_id is still pulling back as 0
    – DEnumber50
    Nov 23, 2016 at 1:06

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.