Micro Focus QTP (UFT) Forums
User-Defined Environment Variable "blank" - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: User-Defined Environment Variable "blank" (/Thread-User-Defined-Environment-Variable-blank)



User-Defined Environment Variable "blank" - LogicaLInsanity - 01-25-2012

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. Sad


RE: User-Defined Environment Variable "blank" - rajpes - 01-31-2012

I guess the reusable action is residing in some other test otherwise all actions in your test should be able to see environment variables


RE: User-Defined Environment Variable "blank" - SteveS - 01-31-2012

I store a number of actions in a Master test and call them from various other scripts, I can set and read environment variables between them without any issues. Are you sure your not clearing the value somewhere else before trying to re read it, i.e. at the end of the Getclient Action?