This document contains hints as to what is required to port a test suite from any version of autopilot to any newer version.
Contents
Autopilot releases are reasonably tightly coupled with Ubuntu releases. However, the autopilot authors maintain separate version numbers, with the aim of separating the autopilot release cadence from the Ubuntu platform release cadence.
Autopilot versions earlier than 1.2 were not publicly announced, and were only used within Canonical. For that reason, this document assumes that version 1.2 is the lowest version of autopilot present “in the wild”.
The 1.3 release included many API breaking changes. Earlier versions of autopilot made several assumptions about where tests would be run, that turned out not to be correct. Autopilot 1.3 brought several much-needed features, including:
- The input stack can now generate events using either the X11 client libraries, or the UInput kernel driver. This is necessary for devices that do not use X11.
- The display stack can now report display information for systems that use both X11 and the mir display server.
- The process stack can now report details regarding running processes & their windows on both Desktop, tablet, and phone platforms.
In autopilot 1.2, tests enabled application introspection services by inheriting from one of two mixin classes: QtIntrospectionTestMixin to enable testing Qt4, Qt5, and Qml applications, and GtkIntrospectionTestMixin to enable testing Gtk 2 and Gtk3 applications. For example, a test case class in autopilot 1.2 might look like this:
from autopilot.introspection.qt import QtIntrospectionTestMixin
from autopilot.testcase import AutopilotTestCase
class MyAppTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
def setUp(self):
super(MyAppTestCase, self).setUp()
self.app = self.launch_test_application("../../my-app")
In Autopilot 1.3, the AutopilotTestCase class contains this functionality directly, so the QtIntrospectionTestMixin and GtkIntrospectionTestMixin classes no longer exist. The above example becomes simpler:
from autopilot.testcase import AutopilotTestCase
class MyAppTestCase(AutopilotTestCase):
def setUp(self):
super(MyAppTestCase, self).setUp()
self.app = self.launch_test_application("../../my-app")
Autopilot will try and determine the introspection type automatically. If this process fails, you can specify the application type manually:
from autopilot.testcase import AutopilotTestCase
class MyAppTestCase(AutopilotTestCase):
def setUp(self):
super(MyAppTestCase, self).setUp()
self.app = self.launch_test_application("../../my-app", app_type='qt')
See also
In autopilot 1.2 and earlier, the autopilot.emulators package held several modules and classes that were used frequently in tests. This package has been removed, and it’s contents merged into the autopilot package. Below is a table showing the basic translations that need to be made:
Old module | New Module |
---|---|
autopilot.emulators.input | autopilot.input |
autopilot.emulators.X11 | Deprecated - use autopilot.input for input and autopilot.display for getting display information. |
autopilot.emulators.bamf | Deprecated - use autopilot.process instead. |