Autopilot

Autopilot Testing

Functional tests

  • Used language is Python
  • Used framework is Autopilot, which has a Qt binding for Autopilot

  • Tests are written from the end-user point of view.
  • Documentation for autopilot is available here.

  • 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

  • sudo apt-add-repository ppa:autopilot/ppa

  • sudo apt-get update

  • sudo apt-get install libautopilot-qt python-autopilot

Documentation

Running tests

  • autopilot run [testsuite]

List tests

  • autopilot list [testsuite]

Introspecting your application

  • autopilot launch qmlscene /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
  • autopilot vis

Getting started with autopilot

What you need:

To be able to autopilot you QML application, you need to install python-autopilot and libautopilot-qt. The package python-autopilot contains the actual autopilot application. The package libautopilot-qt contains bindings for Qt applications.

For now, python-autopilot, libautopilot-qt and dependencies can be found in ppa:autopilot/ppa. In the future it is planned to release autopilot to the base packages of the Ubuntu distribution.

   1 sudo apt-add-repository ppa:autopilot/ppa 
   2 sudo apt-get install python-autopilot libautopilot-qt
   3 

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 add-apt-repository ppa:phablet-team/tools
   2 sudo apt-get update
   3 sudo apt-get install phablet-tools
   4 

Next, run the following commands to setup a tunnel to ssh into the phablet device and install autopilot and the example tests.

   1 adb forward tcp:8888 tcp:22
   2 ssh phablet@localhost -p 8888
   3 

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 add-apt-repository ppa:phablet-team/tools
   2 sudo add-apt-repository ppa:autopilot/ppa
   3 sudo add-apt-repository ppa:phablet-team/ppa
   4 sudo apt-get update
   5 sudo apt-get install autopilot-touch
   6 

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:

  • webbrowser-app-autopilot:

   1 autopilot run webbrowser_app
   2 

* camera-app-autopilot:

   1 autopilot run camera_app
   2 

* telephony-app-autopilot (for a phone):

   1 autopilot run telephony_app
   2 

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 autopilot run camera_app.tests.test_capture.TestCapture.test_record_video
   2 

Globally installed and local tests

Tests can be installed globally in /usr/lib/python2.7/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.

Touch/Testing/Autopilot (last edited 2013-08-01 19:21:40 by kotux)