All my test cases have library/function files associated to them and one of the files I call an init file. In there I create variables for the AUT. Things like the URL, user ID, password, Test Environment (like Test, Stage, Production).
So, for example, I may have this line of code:
gENV = "TEST"
Environment("gENV") = "TEST"
What is the advantage of using the latter?
Oh, and I ask only about creating new variables (I know that the built in ones are extremeley useful!)
Its more like creating a Globally declared variable accessible from any action within the test. It also depends on what data u wish to store in the environment variable, at times people save values extracted from elsewhere and use this in actions and pass it across actions.
Its more to do with the framework and the way u plan to automate as mentioned by my friend in his post.