[LDTP-Dev] Running LDTP tests in Xvfb

Nagappan Alagappan nagappan at gmail.com
Fri Oct 26 15:28:47 PDT 2012


Hi Andres,

On Fri, Oct 26, 2012 at 12:44 PM, Andres Riancho
<andres.riancho at gmail.com>wrote:

> Nagappan,
>
> On Wed, Oct 24, 2012 at 10:54 PM, Nagappan Alagappan <nagappan at gmail.com>
> wrote:
> > Hi Andres,
> >
> > On Wed, Oct 24, 2012 at 6:31 PM, Andres Riancho <
> andres.riancho at gmail.com>
> > wrote:
> >>
> >> Nagappan,
> >>
> >>     Thanks for the quick reply, please read inline:
> >>
> >> On Wed, Oct 24, 2012 at 4:04 PM, Nagappan Alagappan <nagappan at gmail.com
> >
> >> wrote:
> >> > Hi Andres,
> >> >
> >> > Unfortunately the underlying libraries doesn't work based on DISPLAY.
> >>
> >>     That sucks :(
> >
> >
> > I mean to say a11y libraries, anyways you got what I try to convey :-)
> >
> >>
> >>
> >> > You can use either of the approach [1]
> >>
> >>     Executing scripts remotely is not what I need, since I want to
> >> have the code under test and the LDTP test in the same workstation,
> >> ideally developers should be able to run these LDTP tests in their
> >> workstations before a commit.
> >>
> >> > or [2].
> >>
> >>     Hudson X11 is similar to what I've read in Mago's wiki, the
> >> a11yservice.py // a11yclient.py are basically a way to send commands
> >> from one context to the other. The client is run in the Hudson context
> >> and in which context does the service run? xinit?
> >
> >
> > I created this for Mago project. Hudson runs as root user (atleast in
> > Ubuntu). So, I need to create 2 different scripts, a11yservice.py will
> run
> > as regular user and a11yclient.py will run as Hudson user.
>
> Before we continue, thanks for your detailed and quick responses! Now
> to the next set of questions :)
>
> Why are these two lines not run via a11yclient?
>
> # Enable accessibility on the "hudson" user
> gconftool-2 --set --type bool /desktop/gnome/interface/accessibility true
>

If accessibility is not enabled, then we need to enable it, this command
have changed as the underlying libraries changed from CORBA to DBUS. It
should be gsettings. If accessibility is enabled and the following
screensaver-saver is disabled (manually), then you can ignore this and the
following step. Screensaver suspends the accessibility daemon activity, to
run our test continuously, we need to disable screensaver.


> # Accessibility test will hang, if screensaver started during the test
> gconftool-2 --type bool --set
> /apps/gnome-screensaver/idle_activation_enabled false
>
> Are they still effective if you run them with the Hudson/root user?
>

With Hudson user, yes its effective.


>
> >>
> >>     Do you see any possibility to run LDTP tests in xvfb? Is the a11y
> >> service/client the way?
> >
> > If a11yservice.py gets started when the Xvfb session starts, then you can
> > run the test as you expect, by invoking your script with a11yclient.py.
>
> If the tests are invoked like this:
>     /usr/bin/a11yclient.py 'xterm -e "cd mago;PYTHONPATH=. ./bin/mago
> --noa11y -a gedit"'
>
> Or in my case with something similar to:
>     /usr/bin/a11yclient.py 'xterm -e "...;nosetests core/ui/gui/tests/"'
>
> All I'll get from nosetests (which is the test runner I use in my
> project) is the stderr and stdout, correct? In other words, if I want
> to debug the unittest or do anything else it will be completely
> unaccessible because of the a11yclient / xterm combination; correct?
>

Yes, you are correct. Its not recommended to rely stdout / stderr with
subprocess, as it consumes memory, maybe I would suggest to write some log
file, while running the test.


>
> Instead of using the .desktop shortcut, have you tried to start the
> a11y server in xinitrc.hudson? Does it work?
>

I haven't tried that. Please let me know your results.

Thanks
Nagappan


>
> > Hope this helps.
> >
> > Thanks
> > Nagappan
> >
> >>
> >>
> >> Regards,
> >>
> >> > Thanks
> >> > Nagappan
> >> >
> >> > [1] - http://ldtp.freedesktop.org/wiki/Executing_scripts_remotely
> >> > [2] -
> >> > http://bazaar.launchpad.net/~nagappan/hudson-x11-guitest/head/files
> >> >
> >> > On Wed, Oct 24, 2012 at 7:59 AM, Andres Riancho
> >> > <andres.riancho at gmail.com>
> >> > wrote:
> >> >>
> >> >> List,
> >> >>
> >> >>     Sorry if this is a FAQ but I was unable to make it work. I want
> to
> >> >> run LDTP in Xvfb and I don't seem to find how to do it. I've read
> some
> >> >> documents [0][1] and tested extensively but found myself in a
> >> >> dead-end. This is what I'm doing:
> >> >>
> >> >> Console #1, start Xvfb:
> >> >>     /usr/bin/Xvfb :2 -screen 0 1024x768x24 -fbdir /tmp
> >> >>
> >> >> Console #2, start helloworld.py application in :2:
> >> >>     DISPLAY=:2 python helloworld.py
> >> >>
> >> >> Console #3, start VNC server on :2 to verify that helloworld.py is
> >> >> running:
> >> >>     x11vnc -display :2 -shared -forever
> >> >>
> >> >> Connect to the VNC server and find that the window is there. Without
> >> >> window decoration, but it is there.
> >> >>
> >> >> Console #4, run sniff.py [2] on display :2:
> >> >>     DISPLAY=:2 python sniff.py hello
> >> >>
> >> >> Expected result from the last command would be something that
> contains
> >> >> "frmhelloworld.py"; instead I see the list of windows that are in my
> >> >> working X (:0). In other words, getwindowlist [3] seems to be
> ignoring
> >> >> the DISPLAY environment variable. I've also tested this:
> >> >>
> >> >>     export DISPLAY=localhost:2
> >> >>     python sniff.py hello
> >> >>
> >> >> And I still get the same result. If, after the export I run "gedit",
> >> >> the text editor will appear on my Xvfb (which I'm watching using
> VNC).
> >> >>
> >> >> So, the question would be... how do I tell LDTP to "connect" / "run"
> >> >> in a different display? Is there any updated documentation on
> >> >> LDTP+Xvfb?
> >> >>
> >> >> Thanks,
> >> >>
> >> >> [0]
> >> >>
> >> >>
> http://ldtp.freedesktop.org/wiki/Howto_run_ldtp_inside_Xvfb_which_runs_in_xinit_session
> >> >> [1] http://mago.ubuntu.com/Documentation/RunningOnHudson
> >> >> [2]
> >> >>
> >> >>
> https://sourceforge.net/apps/trac/w3af/browser/branches/threading2/core/ui/gtkUi/tests/ldtp_wrapper/sniff.py?rev=6006
> >> >> [3] from ldtp import getwindowlist
> >> >>
> >> >> Regards,
> >> >> --
> >> >> Andrés Riancho
> >> >> Project Leader at w3af - http://w3af.org/
> >> >> Web Application Attack and Audit Framework
> >> >> Twitter: @w3af
> >> >> GPG: 0x93C344F3
> >> >> _______________________________________________
> >> >> LDTP-dev mailing list
> >> >> LDTP-dev at lists.freedesktop.org
> >> >> http://lists.freedesktop.org/mailman/listinfo/ldtp-dev
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Cross platform GUI testing
> >> > Linux Desktop (GUI Application) Testing Project -
> >> > http://ldtp.freedesktop.org
> >> > Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra
> >> > ATOMac - Mac GUI Automation tool - https://github.com/pyatom/pyatom
> >> > http://nagappanal.blogspot.com
> >> >
> >>
> >>
> >>
> >> --
> >> Andrés Riancho
> >> Project Leader at w3af - http://w3af.org/
> >> Web Application Attack and Audit Framework
> >> Twitter: @w3af
> >> GPG: 0x93C344F3
> >
> >
> >
> >
> > --
> > Cross platform GUI testing
> > Linux Desktop (GUI Application) Testing Project -
> > http://ldtp.freedesktop.org
> > Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra
> > ATOMac - Mac GUI Automation tool - https://github.com/pyatom/pyatom
> > http://nagappanal.blogspot.com
> >
>
>
>
> --
> Andrés Riancho
> Project Leader at w3af - http://w3af.org/
> Web Application Attack and Audit Framework
> Twitter: @w3af
> GPG: 0x93C344F3
>



-- 
Cross platform GUI testing
Linux Desktop (GUI Application) Testing Project -
http://ldtp.freedesktop.org
Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra
ATOMac - Mac GUI Automation tool - https://github.com/pyatom/pyatom
http://nagappanal.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/ldtp-dev/attachments/20121026/73d32db2/attachment-0001.html>


More information about the LDTP-dev mailing list