Service Virtualization

  • 1.  How to extract the response from the cURL in DevTest

    Posted Jul 25, 2017 02:14 AM

    In DevTest 9.5, I am using "Execute external command" and triggering the cURL command where I already placed curl.exe in local and I can able to see the expected response.

    I want to use some filter to extract the value from the cURL response and use it in other Test step. please do let me know if anyone tried already.

     

    Thanks

    Viru



  • 2.  Re: How to extract the response from the cURL in DevTest

    Broadcom Employee
    Posted Jul 25, 2017 09:35 AM

    Thank you for visiting our community. The discussion was originally posted to the CA Automation community which is mainly for the CA Server Automation product so I've move this discussion to the DevTest community. 

     

    Cheers,

    Gregg



  • 3.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 25, 2017 09:39 AM

    Try using a Filter.  

    Add a Filter --> Utility --> Store Step Response.

    Assign a property name to the Filter and then you can reference the property value in another step or in an Assertion in the cURL step.



  • 4.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 25, 2017 01:49 PM

    Viru,

     

    Did Joel's recommendation help you out with this issue?



  • 5.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 25, 2017 08:21 PM

    Hi Joel and Reid,

     

    I tried that option already. that will store the whole response but i want particular key : value. In the below i want to extract only tokenId, is there any other option to do that?

     

    E.g: {"tokenId":"AQxxxxxxxxxxxxxx-xxxxx.*xxxxxxxxxxxxxxxxx..*","Url":"*********","rlm":"/"}



  • 6.  Re: How to extract the response from the cURL in DevTest
    Best Answer

    Posted Jul 26, 2017 10:16 AM

    Viru,

     

    After storing the step response, try to use the filter 'Create Property Based on Surrounding Values' to save the tokenId to a different property.

    Here is a link to our documentation regarding this filter: Create Property Based on Surrounding Values - DevTest Solutions - 10.0 - CA Technologies Documentation 

     

    If needed, here is a document that shows how you can capture a value that is generated during execution time and create a filter - How to capture a value that is generated during execution time and create a filter? 

     

    Hope it helps.

    Heloisa



  • 7.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 26, 2017 06:39 PM

    This works for me, Thanks.



  • 8.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 26, 2017 07:12 PM

    Is there any difference in executing the cURL in DevTest workstation & Server.

    I am facing an issue where the cURL getting executed in workstation is not running in server, throws exception.

     

    E.g:

    In workstation below command works

    curl --request POST --data '{\"userName\": \"***\",\"nn\": \"xxxx\",\"givenName\": \"xxxx\",\"mail\": \"uxxxx@***.com\",\"telephoneNumber\": \"09876543\",\"password\": \"******\"}'  "http://******************/user?_action=create"

     

    In Server

    curl --request POST --data '{"userName": "***","nn": "xxxx","givenName": "xxxx","mail": "uxxxx@***.com","telephoneNumber": "09876543","password": "******"}'  "http://******************/user?_action=create"

     

    Could anyone suggest what will be issue or how to resolve it



  • 9.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 26, 2017 07:36 PM

    Is curl installed on the server where component is running?  



  • 10.  Re: How to extract the response from the cURL in DevTest

    Posted Jul 26, 2017 07:54 PM

    Yes Mark, its installed and I tried executing there as well.. and it works