Merge lp:~elopio/autopilot/fix1195092-tutorial-emulator_base into lp:autopilot

Proposed by Leo Arias
Status: Merged
Approved by: Thomi Richards
Approved revision: 251
Merged at revision: 251
Proposed branch: lp:~elopio/autopilot/fix1195092-tutorial-emulator_base
Merge into: lp:autopilot
Diff against target: 26 lines (+14/-3)
1 file modified
docs/tutorial/advanced_autopilot.rst (+14/-3)
To merge this branch: bzr merge lp:~elopio/autopilot/fix1195092-tutorial-emulator_base
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+171707@code.launchpad.net

Commit message

Added to the tutorial the step to pass the custom emulator as an argument to the launch_test_application method.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Looks great - thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/tutorial/advanced_autopilot.rst'
2--- docs/tutorial/advanced_autopilot.rst 2013-05-28 00:52:21 +0000
3+++ docs/tutorial/advanced_autopilot.rst 2013-06-27 03:20:32 +0000
4@@ -250,8 +250,19 @@
5
6 # Add custom methods here...
7
8-3. As long as this custom class has been seen by the python interpreter (usually by importing it somewhere within the test suite), autopilot will use it every time it needs to generate a ``QLabel`` instance. You can also pass this class to methods like :meth:`~autopilot.introspection.DBusIntrospectionObject.select_single` instead of a string. So, for example, the following is a valid way of selecting the QLabel instances in an application::
9-
10- # self.app is the application proxy object.
11+3. Pass the emulator base as an argument to the launch_test_application method on your test class. Something like this::
12+
13+ from autopilot.testcase import AutopilotTestCase
14+
15+ class TestCase(AutopilotTestCase):
16+
17+ def setUp(self):
18+ super(TestCase, self).setUp()
19+ self.app = self.launch_test_application(
20+ '/path/to/the/application',
21+ emulator_base=EmulatorBase)
22+
23+4. You can pass the emulator class to methods like :meth:`~autopilot.introspection.DBusIntrospectionObject.select_single` instead of a string. So, for example, the following is a valid way of selecting the QLabel instances in an application::
24+
25 # Get all QLabels in the applicaton:
26 labels = self.app.select_many(QLabel)

Subscribers

People subscribed via source and target branches