Suggestions on how to temporarily fix some scripts
I am having a bit of an environment issue and am seeking some advice.
Here is the problem. I have inherited a testing environment, where the scripts can be used to test against one of several hosts. The problem is that, if I want to test against host "server1", I have to modify about 70 scripts to point to the environment. If testing "server2", I have to change all these files again to point to the proper environment. I cannot really explain things, but these tests are not run from a harness, but one by one manually (the people who created the environment did not understand how to use the tool).
I cannot make a big change now, because we are in the final phases of testing. But I was wondering as to what could be done as quick fix for now.
One thing that I thought I could do, is to create a file on the local host (in the root of the “C:” drive), that would contain the name of the host to test. Each script would then open the file, read the info, close the file, and start running the scenarios against the specified host. Once a script is done, the next script does the same thing.
I also thought of using the registry, but decided that I did not want to mess up the machine by accident (I used to use the registry with Visual Test, but that was a long, long time ago).
Another possibility is to use a global variable (in the file that has all the routines that I use), but that means that only one person can run the package against one host at the time (they still do not use source control, and the workspace/script are in one location on the LAN). I am leaning towards this short term solution for now.
Any suggestions as to how to best handle this kind of situation (and I hope that I explained it well enough)? Would someone have a solution that I could apply temporarily until I can come up with a permanent solution?
Incidentally, I am using Java as the programming language.
Re: Suggestions on how to temporarily fix some scripts
1) Global variable. Quick and easy.
2) Extending #1 a bit. Create a wrapper script that calls all the other scripts. From the wrapper, prompt the user to enter the servername. Set their answer to a global variable that all the other scripts use.
3) Extended a bit further. Modify each of the scripts to prompt the user for the servername at runtime. Put in a little extra logic that will only prompt if the script is run by itself. I.e. if it is run as part of a superscript and the global variable is already set, don't prompt.
I only use the .NET version of RFT and don't know JAVA but I have to assume the above solutions are just as easy to code in JAVA as they would be in .NET.