Ask a Question

ReadyAPI Integration with TestComplete

Sadeesh
New Contributor

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-... 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 4
AlexKaras
Community Hero

Re: ReadyAPI Integration with TestComplete

Hi,

 

how can we do the following flows

I would recommend to take a look at the aqHttp object in TestComplete (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqhttp/index.html).

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Sadeesh
New Contributor

Re: ReadyAPI Integration with TestComplete

 @AlexKaras  Thanks for your reply and as I mentioned, I need to deal with multipart/form-data requests but I didn't see any appropriate method in the interface https://docs.microsoft.com/en-gb/windows/win32/winhttp/iwinhttprequest-interface?redirectedfrom=MSDN which used byaqHttp object.

So only moved on to ReadyAPI.

AlexKaras
Community Hero

Re: ReadyAPI Integration with TestComplete

Hi,

 

Can you provide sample request and expected response that you need to execute?

 

I am not sure that properties from ReadyAPI can be shared into TestComplete project, but I am pretty sure that property can be saved into file and then TestComplete can read the content of this file.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Sadeesh
New Contributor

Re: ReadyAPI Integration with TestComplete

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:
 
cancel
Showing results for 
Search instead for 
Did you mean: