When writing scripts that are normally driven by a calling script with parameters, I needed a way to set those variables during development. When I first started writing Eggplant code, I was adding and commenting these items out. Of course, there’s always the chance that I forget to comment a parameter out, and it can take a while to find a problem like that. Additionally, since it is interactive, I can set variables each time without changing the script.
In my situation, I have a global variable that always needs to be set. My debug block executes if it is not set, but you may have better ways of triggering it.
My debug block is simple and varies from script to script, but the format is generally the same. It interactively asks for the values of each of the parameters that would normally be set by another calling script. It also logs a warning that the variables were set for debug purposes.
I hope this brings joy to someone else :
if global requiredVariable is ""
ask "You must be in Debug Mode : please enter your global requiredVariable: " with "Default Variable" Title "¿Debug Mode?"
runScriptToSetVariable it
ask "What is parameter2 ? " with 3
set parameter2 to it
ask "What is parameter3 ? " with 1
set parameter3 to it
logwarning " Variables set for Development only!!"
end if