How to access a global variable in a test case

Hi,

I have few test cases which I want to run in multiple environments (DEV, QA, PRE PROD).

So, in the script, I do not want to hard code the URL, instead I want the URL to be fetched at runtime as a global variable.

Note: I am adding test cases in manual mode.

Could you please advise how I can achieve this?

Prabodh Ghosh said:

Hi,

I have few test cases which I want to run in multiple environments (DEV, QA, PRE PROD).

So, in the script, I do not want to hard code the URL, instead I want the URL to be fetched at runtime as a global variable.

Note: I am adding test cases in manual mode.

Could you please advise how I can achieve this?

Well, I found it out after searching for some time.

Double click on Input> Choose Value Type as “Global Variable”> Under ‘Value’ column, pass the intended value and save the test case. That’s it!

Prabodh Ghosh said:

Hi,

I have few test cases which I want to run in multiple environments (DEV, QA, PRE PROD).

So, in the script, I do not want to hard code the URL, instead I want the URL to be fetched at runtime as a global variable.

Note: I am adding test cases in manual mode.

Could you please advise how I can achieve this?

Well, I found it out after searching for some time.

Double click on Input> Choose Value Type as “Global Variable”> Under ‘Value’ column, pass the intended value and save the test case. That’s it!

Well, I found it out after searching for some time.

Double click on Input> Choose Value Type as “Global Variable”> Under ‘Value’ column, pass the intended value and save the test case. That’s it!

1 Like

Just an fyi for anyone else with this question.

Be sure to save your test case and variables after adding them, then click refresh in the global variable window. Otherwise your variables won’t be available in the test case.