Hi,
I am creating a variable username while doing recording of login script. Now i want to use that variable in another recording or code base.So that both the script can read the data from same variable.
Can anyone please let me know how can i make the variable global or how can i use same variable in different files?
Any help would be appreciated and thanks in advance.
Regards,
Rahul Jain
How to use a variable in different files?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to use a variable in different files?
Hi,
Is your variable a Module Variable?
If yes you can for instance create a new global or test case parameter and bind the module variables from the different recordings to the parameter.
This will automatically set the variables from the other modules to the specific value of the login script.
Here is a useful link about this topic: Combining Variables with Parameters.
Regards,
Markus
Is your variable a Module Variable?
If yes you can for instance create a new global or test case parameter and bind the module variables from the different recordings to the parameter.
This will automatically set the variables from the other modules to the specific value of the login script.
Here is a useful link about this topic: Combining Variables with Parameters.
Regards,
Markus
Re: How to use a variable in different files?
Thanks for the reply,
I want to automate following scenario:
1.Enter valid username.
2.Enter valid password.
3.Store password in some variable for eg. var1.
4.After login gets successfully, Go to change password page.
5.Enter old password using the variable var1 in which old password is stored.
6.Now enter new password in new password field and store that password in some variable like var2.
7.From next time when user login it reads the value from var2.
How can i perform the scenario which either overwrite the value of var1 or replace var1 with var2 when i next time run the script.
Please suggest the workaround.
Thanks,
Rahul Jain
I want to automate following scenario:
1.Enter valid username.
2.Enter valid password.
3.Store password in some variable for eg. var1.
4.After login gets successfully, Go to change password page.
5.Enter old password using the variable var1 in which old password is stored.
6.Now enter new password in new password field and store that password in some variable like var2.
7.From next time when user login it reads the value from var2.
How can i perform the scenario which either overwrite the value of var1 or replace var1 with var2 when i next time run the script.
Please suggest the workaround.
Thanks,
Rahul Jain
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to use a variable in different files?
Hi,
Basically you have to create a module variable in the recording where you store the password the first time and
in the Recording or UserCode file where you store the new password.
Now you have two variables and these two variables have to be bound to a global parameter (right click on the test suite and click on Global Parameters...), this will ensure that the second variable will be set to the value of the first and in the next iteration that the first variable will be set to the value of the second one.
Regards,
Markus
Basically you have to create a module variable in the recording where you store the password the first time and
in the Recording or UserCode file where you store the new password.
Now you have two variables and these two variables have to be bound to a global parameter (right click on the test suite and click on Global Parameters...), this will ensure that the second variable will be set to the value of the first and in the next iteration that the first variable will be set to the value of the second one.
Regards,
Markus