Create a script (.js or .qs) that sets the device to its desired state when you open an application in the emulator. Place the script in the
scripts/autostart/ folder to run it automatically when the emulator starts.
You can then use the emulator views to change the default settings according to your test cases. To run the same tests repeatedly or to test complicated sequences of events, create scripts and place them in the
Place you favorite scripts in the
Example scripts are located in
To open the folder that contains the scripts in a file browser, select Show Folder Content. To locate and run scripts in other folders, select Run Other Script.
To run a script:
- Click the JS quick access button to bring up a list of scripts in the
- Double-click a script in the Scripting tab that shows the scripts in the
scripts/folder, or select Run Selected Script.
- Place a script in the
scripts/autostartfolder to run it when the emulator starts.
- Select Run Other Script to run scripts from any folder on the development PC or on a network resource. The script is automatically run when you select it.
- Add the
-runscript <script file>parameter to a call of the emulator application on the command line to trigger the execution of a script in the currently running emulator instance externally.
The Active scripts field shows a list of currently active scripts. To pause or resume a script, select it and click Pause. To abort a script, select it and click Abort.
To edit a script in a text editor, select it and then select Edit Script.
Note: You have to set a default editor for script files (.js or .qs) in your system.
- yield(ms): delay execution of this script for the given number of milliseconds
- emulator: ViewScriptInterface
- location: LocationScriptInterface
- sensors: SensorsScriptInterface
- sysinfo.battery: BatteryInfoScriptInterface
- sysinfo.wlan: WlanInfoScriptInterface
- sysinfo.storage: StorageSystemInfoScriptInterface
- touch: TouchScriptInterface
- input: InputScriptInterface
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.