Is there a way to run multiple scripts in automated user automation tools (iOS)?

Whenever I try to make Apple's UI Automation in Instruments (iPhone simulator) I have several different scripts to run. The problem is that I need to sit back and run each script when the first one ends. I wonder why use Automation if I still need to sit and run each script after another.

Can someone tell me (or is there) a way to run more than one script with one click? and no need to run the record button for each script?

+4
source share
5 answers

I have the same problem. According to official documentation: "You can create as many scripts as you want, but you can only run one at a time."

So, I tried to associate all the scripts with one by importing them:

# import "test1.js" # import "test2.js" 

Save this as a separate script (for example, "testAll.js") and run it.

+7
source

YES!!! You can run a test suite with all your scripts. For example, you can write a script for each screen in your application after creating a test suite to run the entire script, or if you prefer to run only a couple of these scripts. For each script you need to use sendcriptie #import "script1.js". Example:

 //import all scripts that you need to include #import "screen1.js" #import "screen2.js" #import "screen3.js" function Main(){ // Tests: TestScreen1(); // this method is on "screen1.js" TestScreen2(); // this method is on "screen2.js" TestScreen3(); // this method is on "screen3.js" }; // call to function Main Main(); 
+4
source

You can simply run them from the command line. Put all your scripts in a folder and create a sh script

Example:

 FILES=`find <<insert script location>> -iregex '.*\(js\)' ` for script in $FILES do echo "Processing $script instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /"<<insert app location>>/App.app" -e UIASCRIPT $script -e UIARESULTSPATH "<<insert Result path>>" >> "results.txt" done 
+3
source

You can run tools from the command line, so you can use a bash script to run tests in batch mode. Something like that:

 #!/bin/bash instruments -t "$UIA_TRACETEMPLATE_PATH" "$APP_PATH" -e UIASCRIPT "$SCRIPT1_PATH" -e UIARESULTSPATH "$OUTPUT1_PATH" instruments -t "$UIA_TRACETEMPLATE_PATH" "$APP_PATH" -e UIASCRIPT "$SCRIPT2_PATH" -e UIARESULTSPATH "$OUTPUT2_PATH" #etc 

The advantage of this approach is that the tests are separated because the bash script restarts the tools before each test. Even your first test interrupt will continue after the next test.

+2
source

As I know, UIAutomation is one process application and cannot run multiple tests / devices in parallel.

You can read more here: Does tool automation tracing allow only one target connection?

I also tried to start automation for different users, but to no avail. You can use virtual machines or several mac mini for your task.

+1
source

Source: https://habr.com/ru/post/1494652/


All Articles