Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

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

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    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.

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    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.

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    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_parasoft
    benken_parasoft Posts: 1,306 ✭✭✭

    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.

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    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).