Forum Discussion

Sadeesh's avatar
Sadeesh
New Contributor
4 years ago

ReadyAPI Integration with TestComplete

As I'm a beginner in TestComplete, I'm interested to know how can we do the following flows where I need to deal with both API and UI tests.

Before I begin my UI tests, I need to do the following API calls

1) Call POST Request 

2) Get the response from the above POST request and store the particular attribute value in variable "X"

3) Call GET Request with the value stored from the variable "X" 

4) Get the response from the above GET request in step#3 and store the particular attribute value in variable "Y"

5) Call GET Request with the value stored from the variable "Y" 

6) Initiate the browser with URL, Use the value stored from the variable "Y"

 

Tried:

>>I initially start with this<<https://support.smartbear.com/testcomplete/docs/testing-with/advanced/sending-receiving-requests/in-keyword-tests.html#working-with-responses>> but I didn't see any option that how to mention the body-media type: multipart/form-data and get an incorrect response from API calls.

>>So moved on with READY API Integration<<https://youtu.be/gBxt1HYtD9U?t=168>> where I did my API calls as intended and now I'm struggling at the final step where I need to get and store the particular attribute value from the response into the READY API Created Global/Custom property and pass it to test complete.

 

Any help is greatly appreciated and let me know the best practices if any.

4 Replies

      • Sadeesh's avatar
        Sadeesh
        New Contributor

        Thanks, AlexKaras for the kind update.

         

        Here are the sample cURL requests

        //POST request

        1. curl --location --request POST 'URL/oauth/token' \

        --header 'Cookie: "XXXXXXXXX"' \
        --form 'VAR1="VALUE1"' \
        --form 'VAR2="VALUE2"' \
        --form 'VAR3="VALUE3"' \
        --form 'VAR4="VALUE4"'
        //subsequent GET request where the output value from POST request will be referred
        2. curl --location --request GET 'XXXX/create-data' \
        --header 'X-OAuth-Authorization:
        : "token value from the above request"' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'Cookie: XXXXXX'
        //final response where the "VALUE6" needs to grabbed and pass to UI tests
        Response:
        {
        "status": 200,
        "body": {
        "VAR5": "VALUE5",
        "VAR6": "VALUE6",
        ....
        }
        }
         
        Notes:
        1. Though as mentioned in the document, This type of form-data request can be achieved without ReadyAPI with third-party requests package especially in python-script but I also saw a note in Python script documentation that dealing with third-party packages are not the recommended approach as it is not stable during execution.
        2. Since having cURL requests and seems this is possible without ReadyAPI Integration by referring following threads: