dogtail , headless and nosetests



List,

    I'm trying to achieve something that might sound strange at
first... but might be interesting for most of you at the end. For the
w3af [0] project we use unitest.TestCase as our test case development
platform and nosetests [1] as our test runner. During the last days
I've been working on functional testing for our GUI [2] and ended up
choosing dogtail for doing it.

    My objective is to be able to run the following in a command line:
        nosetests -v core/ui/gui/tests/

    And read the test results in the console output, internally I want
each unittest to start a new Xvfb with gnome, run the dogtail a11y
automation code and then stop the xvfb. Please note that I want each
unittest to start a new xvfb (most likely in setUp) and stop the xvfb
at the end (tearDown). I want this in order to isolate my tests; if
test #1 fails, I don't want that impacting #2 nor #3.

    I've achieved almost everything I needed by playing around with
the imports, environment variables, etc. You can read my code here
[3][4]. Please note that I DO NOT want to use dogtail-run-headless, I
want to run my tests with nosetests.

    The only problem I'm having is that dogtail doesn't seem to like
it when I do the following:
        * start xvfb
        * import dogtail
        * stop xvfb
        * start xvfb
        * reload dogtail module

    The error I'm getting is:

Traceback (most recent call last):
  File "/home/fabio/workspace/threading2/core/ui/gui/tests/dogtail_wrapper/dogtail_unittest.py",
line 114, in setUp
    self._setup_env()
  File "/home/fabio/workspace/threading2/core/ui/gui/tests/dogtail_wrapper/dogtail_unittest.py",
line 101, in _setup_env
    reload(tree)
  File "/usr/local/lib/python2.7/dist-packages/dogtail/tree.py", line
1174, in <module>
    children = root.children
  File "/usr/local/lib/python2.7/dist-packages/dogtail/tree.py", line
217, in children
    if self.parent and self.parent.roleName == 'hyper link':
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
    return info.invoke(*args, **kwargs)
GError: Connection was disconnected before a reply was received

    The questions are... anyone knows how to reload() the dogtail
module in the current state I'm in? Anyone played with nosetests and
dogtail before? Any ideas on how to improve what I'm doing?

[0] http://w3af.org/
[1] https://nose.readthedocs.org/en/latest/
[2] https://sourceforge.net/apps/trac/w3af/wiki/GUITestingRequirements
[3] https://sourceforge.net/apps/trac/w3af/browser/branches/threading2/core/ui/gui/tests/dogtail_wrapper/dogtail_unittest.py?rev=6042
[4] https://sourceforge.net/apps/trac/w3af/browser/branches/threading2/core/ui/gui/tests/dogtail_wrapper/tests/test_gnome.py?rev=6042

Regards,
-- 
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
Twitter: @w3af
GPG: 0x93C344F3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]