01-25-2012, 04:23 AM
Hey all,
I'm kind of new to QTP, so bear with me. But, I need some assistance in retrieving the value of a user-defined Environment Variable.
Basically I have one action (login) that calls an existing reusable action (getclient).
The Getclient Action successfully sets 2 environment variables with a statement like: "Environment.Value("List") = excelSheet.Cells (2,1).Value" (It assignes the value from a cell in an excelsheet).
At this point in the test, everything is working fine because the getclient action successfully finishes and I can test with a MsgBox anywhere in there and it will have the values for the environment variables.
The issue arises later on when I try to call the environment variable values from another action after the Login action. In this new action I make a call like "Msgbox Environment.Value("List")" and it comes out blank, where in the getclient action it actually shows the value! This prevents me from passing the environment value into a new function, which is ultimately my goal.
I checked the test settings and under environment > User-defined, I have the variable "List" with no value. Could it be that the original "getclient" action is not correctly saving the environment variable value (from the excel sheet)? But if so, how come it works fine in that action? I am confused.
I'm kind of new to QTP, so bear with me. But, I need some assistance in retrieving the value of a user-defined Environment Variable.
Basically I have one action (login) that calls an existing reusable action (getclient).
The Getclient Action successfully sets 2 environment variables with a statement like: "Environment.Value("List") = excelSheet.Cells (2,1).Value" (It assignes the value from a cell in an excelsheet).
At this point in the test, everything is working fine because the getclient action successfully finishes and I can test with a MsgBox anywhere in there and it will have the values for the environment variables.
The issue arises later on when I try to call the environment variable values from another action after the Login action. In this new action I make a call like "Msgbox Environment.Value("List")" and it comes out blank, where in the getclient action it actually shows the value! This prevents me from passing the environment value into a new function, which is ultimately my goal.
I checked the test settings and under environment > User-defined, I have the variable "List" with no value. Could it be that the original "getclient" action is not correctly saving the environment variable value (from the excel sheet)? But if so, how come it works fine in that action? I am confused.