- Used language is Python
- Tests are written from the end-user point of view.
- Tests should cover the UI interactions and features from end-user point of view.
- Example: Tap a button and something appears. Cause and effect.
- Template can be found from Qt Creator application wizard.
How to install
If you are on trusty, you need to add a ppa sudo apt-add-repository ppa:autopilot/1.5 .
sudo apt-get update
sudo apt-get install libautopilot-qt python3-autopilot python3-autopilot-vis
- autopilot3 run [testsuite]
- autopilot3 list [testsuite]
Introspecting your application
- autopilot3 launch qmlscene -i Qt /path/to/file.qml
- you can specify what type of introspection is needed using the -i flag, such as -i Qt, but autopilot should default to Qt for qml apps
- autopilot3 vis
select the QtQmlViewer Connection from the dropdown
Getting started with autopilot
What you need:
To be able to autopilot you QML application, you need to install python3-autopilot and libautopilot-qt. The package python3-autopilot contains the actual autopilot application. The package libautopilot-qt contains bindings for Qt applications.
Run some examples
In order to run some examples, you'll need to setup your pc and phablet device. Your pc should already have the phablet-tools installed. But if not, do so now.
1 sudo apt-get install phablet-tools 2
Next, run the following commands to setup a tunnel to ssh into the phablet device and install autopilot and the example tests.
1 phablet-shell 2
From this point onwards, your shell is operating on the phablet device. Let's install autopilot. NOTE: The sudo password for the phablet device is "phablet".
1 sudo apt-get install autopilot-touch 2
Now, install some of the existing apps tests and run them.
1 sudo apt-get install camera-app-autopilot indicators-client-autopilot share-app-autopilot mediaplayer-app-autopilot qml-phone-shell-autopilot notes-app-autopilot gallery-app-autopilot phone-app-autopilot webbrowser-app-autopilot ubuntu-ui-toolkit-autopilot 2
Example packages and their commands to run the tests are:
1 autopilot3 run webbrowser_app 2
1 autopilot3 run camera_app 2
Tests can be written either in python 2 or python 3. For python 3 tests use "autopilot3", for python 2 ones use "autopilot".
To see what test cases a test suite has, and selectively run only some of them, use "autopilot list test_suite" where test_suite is one of the above examples. This will print a list with some entries, all starting with the test_suite's name. Copy/Paste the whole string to choose only this test:
1 autopilot3 run camera_app.tests.test_capture.TestCapture.test_record_video 2
Globally installed and local tests
Tests can be installed globally in /usr/lib/python3/dist-packages/ (like the ones in the previous step) or locally. Usually, when you develop tests you want to run them locally instead of installing them all the time. Checkout the code of one of those examples and you will find the following directory in there:
1 tests/autopilot/app_name/ 2
The "app_name" defines the name of the test suite. As this is standard python import stuff, we have to use underscores instead of dashes here.
To run a globally installed test suite, just execute "autopilot run test_suite" from some random directory. To run a local test suite cd to tests/autopilot/. You should see the test suite's name as a directory. Just call "autopilot run test_suite" in here to execute the local one. If a test suite is installed in your system AND can be found in your current working directory, the local one will be given preference.