How to parameterize the URI in Restful sevices and How to call it in TestListener

Hi,

I have UI test case and Using Test Listeners I have the id and status of the test case.

What I need to do is, I have to update the results in management tool using API.

The below bold letters are dynamic… that is… **7791850 is a test case id and 5 is results (Passed, failed… etc).

I have paramterize these two and i have to call this sendRequest in TestListener… Is it possible? **

7791850 & "status_id": 5,
POST https://****.*****.com/index.php?/api/v2/add_result/7791850 HTTP/1.1Accept-Encoding: gzip,deflateAuthorization: Basic AuthenticationContent-Type: application/jsonContent-Length: 85Host: testrail.***.comConnection: Keep-AliveUser-Agent: Apache-HttpClient/4.1.1 (java 1.5){    "status_id": 5,    "comment": "This test failed",    "version": "1.0 RC1 build 3724"}

Chandrasekaran Ganapathy said:

Hi,

I have UI test case and Using Test Listeners I have the id and status of the test case.

What I need to do is, I have to update the results in management tool using API.

The below bold letters are dynamic… that is… **7791850 is a test case id and 5 is results (Passed, failed… etc).

I have paramterize these two and i have to call this sendRequest in TestListener… Is it possible? **

7791850 & "status_id": 5,
POST https://****.*****.com/index.php?/api/v2/add_result/7791850 HTTP/1.1Accept-Encoding: gzip,deflateAuthorization: Basic AuthenticationContent-Type: application/jsonContent-Length: 85Host: ***.***.comConnection: Keep-AliveUser-Agent: Apache-HttpClient/4.1.1 (java 1.5){    "status_id": 5,    "comment": "This test failed",    "version": "1.0 RC1 build 3724"}

Yes, it is possible.

${status} indicate parameters. In your case, it can be:

“status_id” : ${status}

if you have a variable named “status” in the Testcase, its value will be used.

Just FYI - we’ve built a TestRail integration plugin for Katalon Studio. If you have any feedback or suggestions we are happy to hear from you.

https://store.katalon.com/product/13/TestRail-Integration