Hi all, I'm Cecil and have volunteered to write test cases for Ubuntu Touch.

I'm going thru the tutorial and the example didn't quite work. Since I'm
new to python, I thought send out a quick note... I'm sure it's something
simple.

Below is the output, followed by the test itself for easy reference (I just
copied and pasted from the tutorial).

Thanks for the help,
Cecil

*$ autopilot list example*
Loading tests from: /home/cecil/Workspace/autopilot


example.tests.test_window.MainWindowTitleTests.test_main_window_title_string


 1 total tests.
*$ autopilot run -v example*
Loading tests from: /home/cecil/Workspace/autopilot

Tests running...
18:22:10.000 INFO testcase:86 -
************************************************************
18:22:10.001 INFO testcase:87 - Starting test
example.tests.test_window.MainWindowTitleTests.test_main_window_title_string
18:22:10.575 DEBUG _X11:311 - Moving mouse to position 640,512 without
animation.
18:22:10.716 ERROR testresult:23 - ERROR:
example.tests.test_window.MainWindowTitleTests.test_main_window_title_string
18:22:10.717 ERROR testresult:23 - traceback: {{{
Traceback (most recent call last):
  File "/home/cecil/Workspace/autopilot/example/tests/test_window.py", line
20, in test_main_window_title_string
    app_root = self.launch_application()
  File "/home/cecil/Workspace/autopilot/example/tests/test_window.py", line
16, in launch_application
    return self.launch_test_application(full_path, app_type='qt')
AttributeError: 'MainWindowTitleTests' object has no attribute
'launch_test_application'
}}}
======================================================================
ERROR:
example.tests.test_window.MainWindowTitleTests.test_main_window_title_string
----------------------------------------------------------------------
_StringException: test-log: {{{
18:22:10.000 INFO testcase:86 -
************************************************************
18:22:10.001 INFO testcase:87 - Starting test
example.tests.test_window.MainWindowTitleTests.test_main_window_title_string
18:22:10.575 DEBUG _X11:311 - Moving mouse to position 640,512 without
animation.
}}}

Traceback (most recent call last):
  File "/home/cecil/Workspace/autopilot/example/tests/test_window.py", line
20, in test_main_window_title_string
    app_root = self.launch_application()
  File "/home/cecil/Workspace/autopilot/example/tests/test_window.py", line
16, in launch_application
    return self.launch_test_application(full_path, app_type='qt')
AttributeError: 'MainWindowTitleTests' object has no attribute
'launch_test_application'


Ran 1 test in 0.720s
FAILED (failures=1)
$


*Here is the test code:*
*$ cat example/tests/test_window.py*
from autopilot.testcase import AutopilotTestCase
from os.path import abspath, dirname, join
from testtools.matchers import Equals

class MainWindowTitleTests(AutopilotTestCase):

    def launch_application(self):
        """Work out the full path to the application and launch it.

        This is necessary since our test application will not be in $PATH.

        :returns: The application proxy object.

        """
        full_path = abspath(join(dirname(__file__), '..', '..',
'testapp.py'))
        return self.launch_test_application(full_path, app_type='qt')

    def test_main_window_title_string(self):
        """The main window title must be 'Hello World'."""
        app_root = self.launch_application()
        main_window = app_root.select_single('QMainWindow')

        self.assertThat(main_window.windowTitle, Equals("Hello World"))
$
-- 
Ubuntu-quality mailing list
Ubuntu-quality@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-quality

Reply via email to