Service Virtualization

Expand all | Collapse all

How to implement Respone and request pair using All the 4 methods

  • 1.  How to implement Respone and request pair using All the 4 methods

    Posted Jun 04, 2017 11:54 PM

    Using Get , post ,put and delete with both request and response files . 



  • 2.  Re: How to implement Respone and request pair using All the 4 methods

    Posted Jun 05, 2017 09:10 AM

    Hi Meenakshi,

     

    What product is your question referring to? I'd be happy to move it into the right community to get it answered promptly.

     

    -Chris



  • 3.  Re: How to implement Respone and request pair using All the 4 methods

    Posted Jun 05, 2017 09:29 AM

    CA Service Virtualization .



  • 4.  Re: How to implement Respone and request pair using All the 4 methods
    Best Answer

    Posted Jun 06, 2017 11:23 AM

    Start by reviewing the DevTest documentation on creating R/R pairs found here.

    Naming standards are important as the recorder expects some specific file naming constructs.

    Request/Response Pairs - DevTest Solutions - 10.0 - CA Technologies Documentation  

    Examples are provided in the LISA_HOME\Projects folder.

     

    Each of the REST methods generally follows the same pattern.  Requests for example, look like this:

    PUT /rest-example/control/users/save

    Content-Type: application/json

    <other request meta data headers>

    <intentional blank line here>

    {
      "user":{
        "emailAddress":"test@test.com",
        "firstName":"first-9",
        "lastName":"last-9",
        "password":"aaaaaaaa",
        "username":"dmxxx-009"
      }
    }

     

    Or for requests having no input body, but perhaps there are query string parameters...

    GET /rest-example/control/users/save?userId=abcd

    <meta data headers here>

     

    Responses contain the response output associated with the response that corresponds to the request.

    {
      "USER": {
        "emailAddress": "lisa.simpson@itko.com",
        "firstName": "lisa",
        "lastName": "simpson",
        "password": "60fAFoq+W0R4HrLgsfPodkWRw9I=",
        "phoneNumber": "",
        "username": "lisa_simpson"
      }
    }

     

    If you need to add MetaData to the response, provide that information in a sidecar file -- see documentation link above. An example of sidecar information might be:

    HTTP-Response-Code-Text=OK
    HTTP-Response-Code=200
    Content-Type=application/json
    transactionId=ab3CDE226fgh35IJ

    otherHeader=otherHeaderInformation

     

     

    Your file names will following the construct of:

    Request    =  <filename>-req.txt 

    Response   = <filename>-rsp.txt

    Sidecar    = <filename>-rsp-meta.properties

    where <filename>, above, is the same for all three files so the recorder can determine which request pairs off with which response.