Re: dogtail , headless and nosetests



Hi Andrés,

could be more things, however looks like the issue lies with the
a11y bus not getting properly shut or started after the first test.
I am not sure on how nosetests runs the test following each other,
could be that it won't provide for the level of clean-up needed
between two independent gnome sessions.

I'd start by modifying the logout method. The code you are using
is designed solely for GNOME 3.4 and might not work properly in
your case. Unless you need the session to logout by 'clicking'
you can try to simply 'pkill' the gnome-session process in that
method (followed with the sleep already in place)

Should it not help you can try also stooping the a11y specifically
at the end of session - or starting it specifically at the begging
of the new session.

Kill PID's that come out of i.e. this command to do the first:
ps ax | grep at-spi | grep -v grep | awk '{print $1;}'

Or execute this before importing dogtail to do the latter:
/usr/libexec/at-spi-bus-launcher --launch-immediately

Hope some of these help,

Cheers,
Vita

----- Original Message -----
> 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
> _______________________________________________
> dogtail-list mailing list
> dogtail-list gnome org
> https://mail.gnome.org/mailman/listinfo/dogtail-list
> 


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