Robotium on Linux w/o video device

521 views
Skip to first unread message

Bubbleware Technology

unread,
Apr 7, 2011, 8:29:26 PM4/7/11
to Robotium Developers
Hey I am trying to run my robotium tests on a linux based device
(fedora) but the linux device doesn't have a video device. The quick
question is will this effect my Robotium tests (which are currently
failing)?

Specifically I am running an emulator with the "-no-window" option for
the command line. This launches the emulator fine but the robotium
tests fail either sending keys or clicking on buttons. I am able to
run through these tests fine on a windows device with an emulator
launched from the command line with "-no-window" option.

If I run the command to launch the avd normally via "emulator -avd
<avdname>", I receive an error from the system stating:
>SDL init failure, reason is: No available video device

A few failure traces I receive from testing on a device in linux
without a video device are below:
junit.framework.AssertionFailedError: Button with the text: I agree is
not found!
at
com.jayway.android.robotium.solo.Clicker.clickOn(Clicker.java:316)
at
com.jayway.android.robotium.solo.Solo.clickOnButton(Solo.java:676)
...
junit.framework.AssertionFailedError: Can not complete action!
at
com.jayway.android.robotium.solo.RobotiumUtils.sendKeyCode(RobotiumUtils.java:
56)
...

Does anyone have any insight into this behavior? I can't seem to find
any documented information on this. Also I am running Robotium v.2.2.

Yahor Paulavets

unread,
Apr 8, 2011, 2:10:27 AM4/8/11
to robotium-...@googlegroups.com, Bubbleware Technology
Hello,

I think it is not a good idea to use Robotium for this way.
Robotium is designed for UI testing, I think.

For your purposes you can use Instrumentation: getInstrumentation().send* methods.

Or in general adb shell sendevent perl/sh scripts for interacting with device, check my article about
scripting tests: http://softteco.blogspot.com/2011/03/android-low-level-shell-click-on-screen.html
Using sendevent you are able to reproduce any click, key press whatever.
IMHO anyway if you do not need a screen, low level is the best approach.

Best regards,
Yahor


--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To post to this group, send email to robotium-...@googlegroups.com.
To unsubscribe from this group, send email to robotium-develo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotium-developers?hl=en.


Bubbleware Technology

unread,
Apr 8, 2011, 8:24:27 AM4/8/11
to Robotium Developers
Thanks for your response but I think the problem actually lies in
getting "emulator -avd
<avdname>" to run without receiving an error. According to the guides
I've read, the device I'm using is 64 bit linux and currently the only
android sdk is x86. Therefore I need to install the 32 bit packages
as described by this guide here, https://fedoraproject.org/wiki/User:Hpejakle/Android#Hello_Fedora.

Unfortunately, now I'm having issues with installing several of these
32 bit packages as my device says they currently do not exist. I.E.
running "yum yum install glibc.i686 glibc-devel.i686 libstdc++.i686
zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686
libXrandr.i686" gives this response by my system:

Package glibc-2.7-2.i686 already installed and latest version
No package glibc-devel.i686 available.
No package libstdc++.i686 available.
No package zlib-devel.i686 available.
No package ncurses-devel.i686 available.
No package libX11-devel.i686 available.
No package libXrender.i686 available.
No package libXrandr.i686 available.
Nothing to do.

Anyhow, I am currently looking into it and I will post back here if I
find a good solution. Thanks.


On Apr 8, 1:10 am, Yahor Paulavets <ypaulav...@agilefusion.com> wrote:
> Hello,
>
> I think it is not a good idea to use Robotium for this way.
> Robotium is designed for UI testing, I think.
>
> For your purposes you can use Instrumentation: getInstrumentation().send*
> methods.
>
> Or in general adb shell sendevent perl/sh scripts for interacting with
> device, check my article about
> scripting tests:http://softteco.blogspot.com/2011/03/android-low-level-shell-click-on...
> Using sendevent you are able to reproduce any click, key press whatever.
> IMHO anyway if you do not need a screen, low level is the best approach.
>
> Best regards,
> Yahor
>
> On Fri, Apr 8, 2011 at 3:29 AM, Bubbleware Technology <
>

Christopher Orr

unread,
Apr 10, 2011, 5:23:35 PM4/10/11
to robotium-...@googlegroups.com
On 08/04/2011 02:29, Bubbleware Technology wrote:
> Hey I am trying to run my robotium tests on a linux based device
> (fedora) but the linux device doesn't have a video device. The quick
> question is will this effect my Robotium tests (which are currently
> failing)?
>
> Specifically I am running an emulator with the "-no-window" option for
> the command line. This launches the emulator fine but the robotium
> tests fail either sending keys or clicking on buttons. I am able to
> run through these tests fine on a windows device with an emulator
> launched from the command line with "-no-window" option.
>
> If I run the command to launch the avd normally via "emulator -avd
> <avdname>", I receive an error from the system stating:
> >SDL init failure, reason is: No available video device

I have also seen errors occur in tests while running with "-no-window",
and not just with Robotium tests.
Running the emulator without "-no-window" fixed the problem.

Of course, on all systems it's not possible to show the emulator window
(e.g. headless Linux systems), so therefore I use Xvnc to create a fake
X server, which does allow me to display the emulator window, even on
headless build machines.

More precisely, I use the Android Emulator plugin and Xvnc plugin for
Jenkins to do this automatically for me: http://bit.ly/e80cwR

Regards,
Chris

Bubbleware Technology

unread,
Apr 10, 2011, 8:57:15 PM4/10/11
to Robotium Developers
I think the avd SDL issue was a red herring. This post appears to
walk you through getting robotium to work with using the "no-window"
option http://stackoverflow.com/questions/3214531/how-to-send-key-events-to-a-headless-emulator-in-an-instrumentation-test
. I will let you know if this works.

On Apr 8, 7:24 am, Bubbleware Technology
<bubblewaretechnol...@gmail.com> wrote:
> Thanks for your response but I think the problem actually lies in
> getting "emulator -avd
> <avdname>" to run without receiving an error.  According to the guides
> I've read, the device I'm using is 64 bit linux and currently the only
> android sdk is x86.  Therefore I need to install the 32 bit packages
> as described by this guide here,https://fedoraproject.org/wiki/User:Hpejakle/Android#Hello_Fedora.

Bubbleware Technology

unread,
Apr 11, 2011, 6:28:32 PM4/11/11
to Robotium Developers
Just realized that I responded without first refreshing the page to
see your post, Christopher. It looks like we are on the same page.
In my last post I'm actually linking to your response on
stackoverflow. Good to know I was on the right track. Thanks again
for your suggestion, and I'll let you know how it goes with the plugin
Xvnc to fake an X server on my Fedora instance.

On Apr 10, 7:57 pm, Bubbleware Technology
<bubblewaretechnol...@gmail.com> wrote:
> I think the avd SDL issue was a red herring.  This post appears to
> walk you through getting robotium to work with using the "no-window"
> optionhttp://stackoverflow.com/questions/3214531/how-to-send-key-events-to-...

Bubbleware Technology

unread,
Apr 21, 2011, 12:06:41 AM4/21/11
to Robotium Developers
Hey Chris, thanks again for the advice but I think I'm missing
something setting this up as you suggested.

I installed the Hudson Xvnc plugin as suggested. I configured the
system by logging in as Hudson on my device and installing vnc-server
then running vncserver to create & set up a password. I then killed
that vncserver with "vncserver -kill :1". Unfortunately, I am
receiving the following error when I try to run my build about
requiring a password to access your desktops. Any ideas on this? (I
have tried checking the "Clean up before start" option)

Here is the full console output:

Starting xvnc
[workspace] $ vncserver :26

You will require a password to access your desktops.

getpassword error: Invalid argument
Password:Starting xvnc
[workspace] $ vncserver :27

You will require a password to access your desktops.

getpassword error: Invalid argument
Password:Starting xvnc
[workspace] $ vncserver :28

You will require a password to access your desktops.

getpassword error: Invalid argument
Password:Starting xvnc
[workspace] $ vncserver :29

You will require a password to access your desktops.

getpassword error: Invalid argument
Password:ERROR: Failed to parse POMs
java.io.IOException: Failed to run 'vncserver :29' (exit code 1),
blacklisting display #29; consider checking the "Clean up before
start" option
at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:100)
at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98)
at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98)
at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98)
at hudson.plugins.xvnc.Xvnc.setUp(Xvnc.java:73)
at hudson.maven.MavenModuleSetBuild
$RunnerImpl.doRun(MavenModuleSetBuild.java:521)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:
420)
at hudson.model.Run.run(Run.java:1362)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:405)
at hudson.model.ResourceController.execute(ResourceController.java:
88)
at hudson.model.Executor.run(Executor.java:145)
Finished: FAILURE

Christopher Orr

unread,
Apr 26, 2011, 7:44:58 PM4/26/11
to robotium-...@googlegroups.com
I don't have access to my Jenkins build machine just now to check, but
as seem to recall the solution is to find the .vnc/passwd file (or
whatever it's named) and delete the contents, so there is no password.

Hopefully that helps.

Regards,
Chris


On 21/04/2011 06:06, Bubbleware Technology wrote:
> Hey Chris, thanks again for the advice but I think I'm missing
> something setting this up as you suggested.
>
> I installed the Hudson Xvnc plugin as suggested. I configured the
> system by logging in as Hudson on my device and installing vnc-server

> then running vncserver to create& set up a password. I then killed

Bubbleware Technology

unread,
Apr 26, 2011, 10:12:47 PM4/26/11
to Robotium Developers
Thanks so much for your response. Unfortunately, I think I may be
confused by what you intended to be done by your last message.

Specifically, I tried navigating to my .vnc/passwd file under the user
Hudson and removing its contents. I still get this same error in my
console output. Likewise I tried navigating to my .vnc/passwd file
under the root user and removing its contents. Other ways I tried
were simply removing that file and re-running the "vncserver" command
(both as root & hudson). None of these methods seemed to solve this
problem.

Do you know of another method to fix this password error? Or am I
missing something in your last message?

Thanks again-
Dave

marekdef

unread,
Apr 28, 2011, 4:30:09 AM4/28/11
to Robotium Developers
I think essential is to know what is on the screen. Is it possible you
make a screenshot ?
I mean with eclipse for example (this works even if -no-window just
checked!).
But you need emulator and eclipse on the same machine.

I have shortly described different ways of getting screenshots here,
so I guess
http://blogprogramistyandroid.blogspot.com/2011/03/taking-screenshot-in-android.html

I would say that there should be no difference in test executions
between headless emulator and normal one.

Regards.

Christopher Orr

unread,
Apr 28, 2011, 4:41:16 AM4/28/11
to robotium-...@googlegroups.com
Hi there,

I just checked my Jenkins setup and my ~/.vnc/passwd file is indeed
empty. But I have a feeling that I solved this another way...

In the Jenkins main configuration page, I have this set as my Xvnc
command line:

/usr/bin/env Xvnc :$DISPLAY_NUMBER -localhost -geometry 1280x1024 -depth
24 -SecurityTypes None

I believe setting SecurityTypes to None should do the trick.

Regards,
Chris


On 27/04/11 04:12, Bubbleware Technology wrote:
> Thanks so much for your response. Unfortunately, I think I may be
> confused by what you intended to be done by your last message.
>
> Specifically, I tried navigating to my .vnc/passwd file under the user
> Hudson and removing its contents. I still get this same error in my
> console output. Likewise I tried navigating to my .vnc/passwd file
> under the root user and removing its contents. Other ways I tried
> were simply removing that file and re-running the "vncserver" command

> (both as root& hudson). None of these methods seemed to solve this

Bubbleware Technology

unread,
May 7, 2011, 11:21:19 AM5/7/11
to Robotium Developers
Thanks Christopher, your response worked and the Xvnc server now
launches.
Reply all
Reply to author
Forward
0 new messages