I'm trying to send some arguments to UI Automation scripts through the command-line where the scripts could grab those arguments and execute some specific test cases conditionally based on those received arguments. Is there a way to do this? I saw in the manual page for the instruments command that it mentioned something about arguments.
argument ~ Command line argument to be sent to the launched process (You may specify more than one)
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/instruments.1.html
... Or should I just split the conditional code into different files and have some external shell scripts to handle changing of the file name to be executed through the instruments command-line instead?
My workaround on this problem uses an exported environment variable and the UIATarget.localTarget().host().performTaskWithPathArgumentsTimeout(...)
command to acquire that parameter.
Export an environment variable in the shell
export PARAM_TO_UIA="theParameterValue"
Launch instruments from the same shell
Acquire the parameter inside your UIAutomation script
var result = target.host().performTaskWithPathArgumentsTimeout("/usr/bin/printenv" , ["PARAM_TO_UIA"], 5);
var parameter = result.stdout.substring(0,result.stdout.length-1);
Last command removes '\n' from the end of the result.stdout
string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With