https://${base}.omnipodapps.com/api/v3/provisioning/nonce?base=horizonmobile-int
Above URI is an get request how can i parameterized the environment in katlon studio
https://${base}.omnipodapps.com/api/v3/provisioning/nonce?base=horizonmobile-int
Above URI is an get request how can i parameterized the environment in katlon studio
To parameterize the environment for your API request in Katalon Studio, follow these steps:
Profiles
in Katalon Studio.baseSubdomain
in each profile (e.g., Default, QA, Staging) with the appropriate subdomain value (e.g., horizonmobile-int
, qa
, staging
).#{baseSubdomain}
in the URL:https://#{baseSubdomain}.omnipodapps.com/api/v3/provisioning/nonce?base=horizonmobile-int
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
// Retrieve the subdomain from the active profile
def baseSubdomain = GlobalVariable.baseSubdomain
// Send the parameterized request
def response = WS.sendRequest(findTestObject('Get_Nonce_API_Request', [('baseSubdomain'): baseSubdomain]))
// Validate response (example)
WS.verifyResponseStatusCode(response, 200)
baseSubdomain
.This setup allows you to easily switch environments by changing the active profile, ensuring the correct subdomain is used in your API requests.
As @dineshh explained, it is possible to parameterize variables using {}
annotation.
First: Create a API test object
On the URL field. set the URL with the variable field using ${}
Define the “base” variable on the Profiles Folder.
Then, create a new Test Case and use Send Request keyword:
1- Pass the Parametrized_API_test object as the Object for that keyword
2- Add a Variable using “Add” button on the Variables sections and write “base”.
3- The default value of that base variable should be set to GlobalVariable.base (It is suggested on the comboBox.
And that’s it.
If you run the test case (be carefull to previously select Staging profile) you will be using “staging” as the value of that URL.
If you create another Execution Profile, for exaple “Dev” you can create the sabe “base” variable and switch easily between environments.