cancel
Showing results for 
Search instead for 
Did you mean: 

Project variable to be used across different tests

SOLVED
Nayak_Ragh
Occasional Contributor

Project variable to be used across different tests

I am having a Desktop application where one test captures certain dynamically generated ID and it needs to be passed as an input to another test.

 

Ex: Var1 is captured in Test1 - Unit1 script, through function InvID()

 

Now, I need to pass this Var1 as an input to one of the field in Test2.

 

Questions :

1. How do I declare the variable Var1 as global or Project variable

2. How do I call this variable, Var1, in the keyword driven testing, to pass it as an input to the new field in Test2

 

Thanks in Advance.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tphillips
Community Leader

Re: Project variable to be used across different tests

You need to create the variable at the project or project suite level if you're using keyword tests

If you're scripting you can add project or project suite variables in the script itself:

Project.Variables.AddVariable("MyNewVariable", "String");

 

Refer to the documentation for more information:

Project/Project Suite Variables in keyword tests 

Project/Project Suite Variables in scripts 

 

Actually using them is much the same as in your original question in the other thread.


--------------------
QA Systems Architect

View solution in original post

3 REPLIES 3
tphillips
Community Leader

Re: Project variable to be used across different tests

Hi

 

You have already asked this question, and it's been answered for you here. Did the answer not work for you?

Can you add more information if it's not working for you?


--------------------
QA Systems Architect
Nayak_Ragh
Occasional Contributor

Re: Project variable to be used across different tests

Highlevel scenario is same and I understand, we need to execute both the testcases in a sequence but here, I am trying to learn specifically how to declare variables globally / at project level in one test case and use it on another test case

 

1. How do I declare the variable Var1 as global or Project variable in Test1

2. How do I call this variable, Var1, in the keyword driven testing, to pass it as an input to the new field in Test2

 

 

tphillips
Community Leader

Re: Project variable to be used across different tests

You need to create the variable at the project or project suite level if you're using keyword tests

If you're scripting you can add project or project suite variables in the script itself:

Project.Variables.AddVariable("MyNewVariable", "String");

 

Refer to the documentation for more information:

Project/Project Suite Variables in keyword tests 

Project/Project Suite Variables in scripts 

 

Actually using them is much the same as in your original question in the other thread.


--------------------
QA Systems Architect

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors