Forum Discussion
Hi Dev,
As you said, there is no way to pass a variable to USEUNIT. This statement is used to link script units inside a project.
I can suggest that you store a script unit name in a project variable, and run the script execution by using the Exec method. Will this work for you?
- devnyk10 years agoNew Contributor
My requirement is to run only specific test scripts that are marked active in the Excelsheet. The challenge is that name of the script to be executed will become known only at the runtime.
Will I be able to add the Script Unit Names fetched from excel to the Project Variables at Run time?
I would appreciate if you could share some sample program of using combination of Project Variables and the Exec command as you suggested.
- cunderw10 years agoCommunity Hero
Assuming you already have all of your useunits in your driver script you could do something like this:
scriptName = ... read script names one by one from excel ... strCommand = scriptName + ".Test();" eval(strCommand);
- devnyk10 years agoNew Contributor
That exactly is my constraint. I cannot have all the scripts marked as "USEUNIT" in the driver.
Given there will be 1000+ test scripts, it wont be advisable to import all the test scripts in the driver. It will heavily increase the memory footprint of the program, and also will become difficult for maintenance as the project grows. The above proposed solution is exactly what I am willing to do, but with USEUNIT <scriptname>.
Could you suggest a solution to achieve anything equivalant to "USEUNIT <scriptname>" where scriptname is a variable