Hey there !
I have a Test Set which I'm runnung from Test Director.
I initialize :
environment("var1")="value" in one Test Case. OK.
In another Test Case (which exequted right after first one) I try to get that value and it just generete error !!!
Does somebody know about it something ??? [img]images/icons/confused.gif[/img]
Firstly, I believe the assignment statement should be environment.value("var1")="value".
Secondly, this value will last for the duration of a script run. So if you declare it within one action in a script, the subsequent actions can use the value. However, this does not hold true for actions in subsequent scripts.
Storing the value in an external DataTable or Notepad is your other option (DT is recommended) so I'd say you are on the right path now.
fishbrain basically made the same point as mark, but with a twist and that is you need to store the value in an external file. Good thing about fishbrians ways is that to access the values all you have to do is mark the file to be loaded in your Environment test settings for User defined variables. I'd do it fishbrians way too.
I'm trying to understand what you are ultimately trying to accomplish by storing an array in an environment variable. I did a little looking about - Unix allows a history file that stores your commands in sequence - but it is actually stored in a file on disk. It functions as if it were in memory where you can retrieve prior commands - but again it is on disk. For dynamic data that you want to access from successive runs you may be better off writing the values to a file - writeline - then accessing in the next run with readline. Then you can save them off if the machine crashes midrun. I don't think the environment supports structures, only variables/strings. You could set the variable to point to the new file - then use that in the next run. I hope this helps.
Thanks for your Reply I am Not Clear Can you Give me an Example just like Me :-)
Hope You are Clear what I am asking about, I repeat Once again
"I will Load any File Type Txt/XML into an Environment Using Option By QTP
Environment.LoadFromFile("File Type"),after Loading I want to Get the Content of the File loaded into Environment"