How to get the request url/parameter values in Response tab

Is there a way to get the request url/parameter values in the Response tab and perform validations using Groovy script.
I am able to get the values and perform validations on the Responder correlation Custom tab.

Tagged:

Comments

  • williammccuskerwilliammccusker Posts: 227 ✭✭

    Hi,
    What would be the purpose of doing the validation in the Response tab? The correlations can validate and determine which responder with be picked so I am not sure I understand the purpose of verifying in the Response tab which is meant to be the payload.

  • I am trying to validate in the Response tab, because I will be getting dynamic dates in the request. If the dates are static I can validate the dates in Responder Correlation
    and define my response, but if my dates are dynamic I can't create multiple responders with the dates combinations.

  • williammccuskerwilliammccusker Posts: 227 ✭✭

    Hi,
    In your case how are you validating these dynamic dates? What is the condition for a date to be considered good?

  • I can validate the dates which are coming in the request will fall into 90 days range by giving one static date or by comparing with today, using the groovy script in Responder correlation tab.

  • williammccuskerwilliammccusker Posts: 227 ✭✭

    Hi,
    You should be able to script that in the correlation tab. The script would get the current date and then compare the extracted date to determine if it was within the range. Then just return true if it is in the range otherwise false. Anything that you put into a script in the responder tab should work in the correlation script. Could you send the script you are trying to use?

  • Yes, that is true. I am able to validate the dates in the Responder correlation tab. My question here is, how I can respond with different responses for different date combinations without creating multiple responders. Becuase if I want to create the combinations of the dates for 90 days, its not possible.

  • benken_parasoftbenken_parasoft Posts: 773 ✭✭✭

    If you want to send different values in a response depending on the request then what I think you want is to configure your responder to use a data source. Each row in the data source can provide values for a different response. You configure the data source correlation settings in the responder to select the row.

  • Thank you. I believe we have to configure all the possible combinations in the data source to make it work. Correct me if I am wrong.

  • williammccuskerwilliammccusker Posts: 227 ✭✭

    In the data source you would put the possible response values. If the possible response values are dynamic but can be computed then you could script individual values in the response payload using Form Input or Form JSON depending on payload type (xml or json).

Sign In or Register to comment.