Robotium on Linux without video

488 views
Skip to first unread message

Dirk Vranckaert

unread,
Mar 2, 2012, 9:45:30 AM3/2/12
to Robotium Developers
Hey,

I'm trying to run my Robotium tests on a Linux server without a video
device, running a Jenkins CI server.

I found that I should setup XVNC for that, but it doesn't work.

What I did: I had already a build plan in Jenkins that was working
witouth UI tests.
Then I added UI tests with Robotium, test started failing
(junit.framework.AssertionFailedError: Click can not be completed).

I then installed XVNC on my linux server and the plugin for Jenkins.
In the Jenkins settings I've setup this command line:
"/usr/bin/env Xvnc :$DISPLAY_NUMBER -localhost -geometry 480x800 -
depth 24" (without quotes)
Base display number is set to 10
And the flag to clean-up before start is checked.

And still this doesn't work.

I also tried (I found this on the groups here also) to add the flag "-
SecurityTypes None" to the command line but then I had an error that
this flag is not supported...
Maybe I installed a wrong version of XVNC? I did install
"tightvncserver" which installs the package vncserver.

Do you have an idea what might be wrong with my plan?

Here is part of my logging:
Starting xvnc
[workspace] $ /usr/bin/env Xvnc :33 -localhost -geometry 480x800 -
depth 24
02/03/12 15:20:11 Xvnc version TightVNC-1.3.9
02/03/12 15:20:11 Copyright (C) 2000-2007 TightVNC Group
02/03/12 15:20:11 Copyright (C) 1999 AT&T Laboratories Cambridge
02/03/12 15:20:11 All Rights Reserved.
02/03/12 15:20:11 See http://www.tightvnc.com/ for information on
TightVNC
02/03/12 15:20:11 Desktop name 'x11' (kiwi:33)
02/03/12 15:20:11 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t,
3.8t
02/03/12 15:20:11 Listening for VNC connections on TCP port 5933
[android] Using Android SDK: /JAVA_APPS/android-sdk-linux
[android] Waiting 10 seconds before starting emulator...
Font directory '/usr/share/fonts/X11/Speedo/' not found - ignoring
Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb start-server
$ /JAVA_APPS/android-sdk-linux/tools/emulator -snapshot-list -no-
window -avd hudson_en-US_240_WVGA_android-7
[android] Starting Android emulator from snapshot
[android] Erasing existing emulator data...
$ /JAVA_APPS/android-sdk-linux/tools/emulator -no-boot-anim -ports
58097,48659 -prop persist.sys.language=en -prop persist.sys.country=US
-avd hudson_en-US_240_WVGA_android-7 -snapshot jenkins -no-snapshot-
save -wipe-data -no-window
* daemon not running. starting it now on port 40779 *
* daemon started successfully *
WARNING: Cache partition already in use. Changes will not persist!
waitpid(): No child processes
emulator: warning: opening audio output failed

emulator: WARNING: Unable to create sensors port: Connection refused
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb connect localhost:
48659
[android] Waiting for emulator to finish booting...
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb -s localhost:48659
shell getprop dev.bootcomplete
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb connect localhost:
48659
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb -s localhost:48659
shell getprop dev.bootcomplete
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb disconnect localhost:
48659
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb connect localhost:
48659
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb -s localhost:48659
shell getprop dev.bootcomplete
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb connect localhost:
48659
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb -s localhost:48659
shell getprop dev.bootcomplete
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb -s localhost:48659
logcat -v time
$ /JAVA_APPS/android-sdk-linux/platform-tools/adb connect localhost:
48659
[android] Emulator is ready for use (took 60 seconds)
[android-test] $ /JAVA_APPS/apache-ant-1.8.2/bin/ant -file build.xml -
Dsdk.dir=/JAVA_APPS/android-sdk-linux all clean emma debug install
test
Buildfile: /var/lib/jenkins/jobs/VVL_Trunk_Nightly/workspace/android-
test/build.xml


So the server is started correctly and my emulator is started
correctly.

Then suddenly when testing these errors like this one start showing:
[exec] Failure in testValidation:
[exec] junit.framework.AssertionFailedError: Click can not be
completed!
[exec] at
com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:
82)
[exec] at
com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:
157)
[exec] at
com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:
130)
[exec] at
com.jayway.android.robotium.solo.Solo.clickOnView(Solo.java:785)
[exec] at
eu.vranckaert.vvl.activities.trafficinfo.TrafficInfoTextActivityTest.testValidation(TrafficInfoTextActivityTest.java:
126)
[exec] at java.lang.reflect.Method.invokeNative(Native Method)
[exec] at
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:
205)
[exec] at
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:
195)
[exec] at
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:
175)
[exec] at
android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
[exec] at
android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
[exec] at
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:
430)
[exec] at android.app.Instrumentation
$InstrumentationThread.run(Instrumentation.java:1447)

Christopher Orr

unread,
Mar 7, 2012, 4:16:14 PM3/7/12
to robotium-...@googlegroups.com
Hi there,

If you've got Xvnc running, have you also checked the "Show emulator window" option in the Jenkins plugin, to make sure the window actually is shown?
Otherwise, I'd check that the emulator has its screen unlocked before the tests run -- though this should happen automatically when starting an emulator via Jenkins.

Do the tests run successfully on an emulator running outside of Jenkins, e.g. on your local machine?

Regards,
Chris

Dirk Vranckaert

unread,
Mar 8, 2012, 7:59:14 AM3/8/12
to robotium-...@googlegroups.com
Thanks for the response,

that is indeed something I forgot! :)
Thanks for pointing that out to me.. It's currently building so I don't know yet if it worked but I trust it will!

Another question I'm having is how I can let my Android test fail the jenkins build.
When executing the tests with ant locally the ant build fails if a test fails. But when executing them on jenkins the build does not fail for failed tests.

The goals I'm executing are:

all clean emma debug install test

Kr,

Dirk

Op woensdag 7 maart 2012 22:16:14 UTC+1 schreef Christopher Orr het volgende:

Dirk Vranckaert

unread,
Mar 8, 2012, 8:21:03 AM3/8/12
to robotium-...@googlegroups.com
Euhm, still my previous problem exists...

The checkbox 'show emulator window' is on now, but still I have exceptions like this:

     [exec] Failure in testWithOneDefaultValue:
     [exec] junit.framework.AssertionFailedError: Click can not be completed!
     [exec] 	at com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:82)
     [exec] 	at com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:157)
     [exec] 	at com.jayway.android.robotium.solo.Clicker.clickOnScreen(Clicker.java:130)
     [exec] 	at com.jayway.android.robotium.solo.Solo.clickOnView(Solo.java:785)
     [exec] 	at eu.vranckaert.vvl.utils.view.MultiSelectSpinnerTest.testWithOneDefaultValue(MultiSelectSpinnerTest.java:181)
     [exec] 	at java.lang.reflect.Method.invokeNative(Native Method)
     [exec] 	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:205)
     [exec] 	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:195)
     [exec] 	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:175)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
     [exec] 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
     [exec] 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)

Op donderdag 8 maart 2012 13:59:14 UTC+1 schreef Dirk Vranckaert het volgende:

Christopher Orr

unread,
Mar 8, 2012, 6:22:18 PM3/8/12
to robotium-...@googlegroups.com
If your Robotium tests are still failing, the questions in my original
email still apply :)

As for changing the Jenkins result based on Android test results, you
need to output test results in JUnit format on the emulator and then
extract the XML file from the emulator.

Then you can choose the "Publish JUnit test result report" option, which
will mark your build as stable or unstable appropriately.

To integrate JUnit test runner, check out the steps here:
https://github.com/jsankey/android-junit-report#readme

Regards,
Chris

> --
> You received this message because you are subscribed to the Google
> Groups "Robotium Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/robotium-developers/-/Drha9Z8DUGEJ.
> 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.

Dirk Vranckaert

unread,
Mar 9, 2012, 3:13:07 AM3/9/12
to robotium-...@googlegroups.com
Thanks, the android junit test are working correctly now! :)

For the Robotium tests however, how can I check if the emulator window is locked? Because it runs on a headless linux server...

Kr,

Dirk

Op vrijdag 9 maart 2012 00:22:18 UTC+1 schreef Christopher Orr het volgende:

> To post to this group, send email to robotium-developers@googlegroups.com.


> To unsubscribe from this group, send email to


> For more options, visit this group at
> http://groups.google.com/group/robotium-developers?hl=en.


Op vrijdag 9 maart 2012 00:22:18 UTC+1 schreef Christopher Orr het volgende:

> To post to this group, send email to robotium-developers@googlegroups.com.


> To unsubscribe from this group, send email to

> robotium-developers+unsub...@googlegroups.com.

Dirk Vranckaert

unread,
Mar 12, 2012, 10:23:24 AM3/12/12
to robotium-...@googlegroups.com
I implemented a feature to take a screenshot from my device or emulator. Locally this works perfectly, but on the server it does not.

To take a screenshot I do solo.getViews();
But on the server solo does not contain any views... That's why it's not working.

So that gets us a little closer to what's wrong, the emulator is not running headless (I checked the 'show emulator window' checkbox in my project configuration) so it's not launched on the XVNC...

Any idea why?

The XVNC command in my server settings is: "/usr/bin/env Xvnc :$DISPLAY_NUMBER -localhost -geometry 1280x1024 -depth  24"
and in my project settings I checked 'Run Xvnc during build '
I have no clue what could be wrong now...


In my project settings, for the emulator I have checked:
- reset at startup
- show emulator window
- use emulator snapshots

Should I specify emulator options?? :s

Kr,

Dirk

Op vrijdag 9 maart 2012 09:13:07 UTC+1 schreef Dirk Vranckaert het volgende:

Dirk Vranckaert

unread,
Mar 13, 2012, 10:45:34 AM3/13/12
to robotium-...@googlegroups.com
I found the issue!

The emulator is started correctly on the XVNC server.

But when the emulator is booted some of the default applications are crashing.
For example the first dialog says: "Process android.process.media is not responding"
Then the force close and the wait buttons are displayed.

However when the first test is launched the popups do not go away, and so they block the UI!

Do you have any idea how I can remove the popups automatically (or with emulator arguments or something..?)?

Kr,

Dirk Vranckaert

Op maandag 12 maart 2012 15:23:24 UTC+1 schreef Dirk Vranckaert het volgende:

Yahor Paulavets

unread,
Mar 14, 2012, 1:44:32 AM3/14/12
to robotium-...@googlegroups.com
Hello Dirk,

Good job!

Any time I saw "Process android.process.media is not responding" message, there were no way to get it working :(
If you close this popup, it would appear again anyway.

Thank you for discovering such interesting subject, keep going!

Best regards,
Yahor

To view this discussion on the web visit https://groups.google.com/d/msg/robotium-developers/-/sVJqnEzeNEMJ.

To post to this group, send email to robotium-...@googlegroups.com.
To unsubscribe from this group, send email to robotium-develo...@googlegroups.com.

Christopher Orr

unread,
Mar 13, 2012, 7:10:44 PM3/13/12
to robotium-...@googlegroups.com
Hi there,

Interesting -- I'm sure I've seen something like that before, but it
didn't seem to have an impact on our tests running.

You could try telling the emulator to "press the Back button" just
before you run your tests, to get rid of the popup.

Running this command from Jenkins should work to press Back:
adb shell input keyevent 4

Regards,
Chris

> <https://groups.google.com/d/msg/robotium-developers/-/Drha9Z8DUGEJ>.


> > To post to this group, send email to

> robotium-...@googlegroups.com
> <mailto:robotium-...@googlegroups.com>.


> > To unsubscribe from this group, send email to

> > robotium-develo...@googlegroups.com
> <mailto:robotium-developers%2Bunsu...@googlegroups.com>.


> > For more options, visit this group at
> > http://groups.google.com/group/robotium-developers?hl=en

> <http://groups.google.com/group/robotium-developers?hl=en>.

> <https://groups.google.com/d/msg/robotium-developers/-/Drha9Z8DUGEJ>.


> > To post to this group, send email to

> robotium-...@googlegroups.com
> <mailto:robotium-...@googlegroups.com>.


> > To unsubscribe from this group, send email to

> > robotium-develo...@googlegroups.com
> <mailto:robotium-developers%2Bunsu...@googlegroups.com>.


> > For more options, visit this group at
> > http://groups.google.com/group/robotium-developers?hl=en

> <http://groups.google.com/group/robotium-developers?hl=en>.


>
> --
> You received this message because you are subscribed to the Google
> Groups "Robotium Developers" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/robotium-developers/-/sVJqnEzeNEMJ.
> To post to this group, send email to robotium-...@googlegroups.com.


> To unsubscribe from this group, send email to

> robotium-develo...@googlegroups.com.

Dirk Vranckaert

unread,
Mar 14, 2012, 3:55:55 AM3/14/12
to robotium-...@googlegroups.com
Thanks a lot for the help! :)
I finally have my robotium tests working on Jenkins :)

The idea of performing some keyevents through adb made me thinking of executing a back-button event 5 times. 5 times should be sufficient for the number of dialogs shown.
However executing the keyevent 4 does not change anything.

On the screenshots I saw that by default the 'Force close' button is selected so I decided to add 5 more keyevents but this time for even 25 (DPAD center) and after that the tests can be executed and do no longer fail!

So in my ant build.xml file I've added an extra target that I call just before starting the tests:

    <target name="-remove-emulator-dialogs" description="Execute a press on the back button of the emulator five times to make sure that any open apps/dialogs are gone!">
        <echo>Executing keyvent 4 = KEYCODE_BACK</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="4" />
        </exec>
        <echo>Executing keyvent 4 = KEYCODE_BACK</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="4" />
        </exec>
        <echo>Executing keyvent 4 = KEYCODE_BACK</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="4" />
        </exec>
        <echo>Executing keyvent 4 = KEYCODE_BACK</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="4" />
        </exec>
        <echo>Executing keyvent 4 = KEYCODE_BACK</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="4" />
        </exec>
        <echo>Executing keyvent 23 = KEYCODE_DPAD_CENTER</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="23" />
        </exec>
        <echo>Executing keyvent 23 = KEYCODE_DPAD_CENTER</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="23" />
        </exec>
        <echo>Executing keyvent 23 = KEYCODE_DPAD_CENTER</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="23" />
        </exec>
        <echo>Executing keyvent 23 = KEYCODE_DPAD_CENTER</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="23" />
        </exec>
        <echo>Executing keyvent 23 = KEYCODE_DPAD_CENTER</echo>
        <exec executable="${adb}" failonerror="true">
            <arg line="${adb.device.arg}" />
            <arg value="shell" />
            <arg value="input" />
            <arg value="keyevent" />
            <arg value="23" />
        </exec>
    </target>

Op woensdag 14 maart 2012 00:10:44 UTC+1 schreef Christopher Orr het volgende:

>             robotium-developers@googlegroups.com
>             <mailto:robotium-developers@googlegroups.com>.


>              > To unsubscribe from this group, send email to

>             robotium-developers@googlegroups.com
>             <mailto:robotium-developers@googlegroups.com>.


>              > To unsubscribe from this group, send email to


>             <mailto:robotium-developers%2Bunsu...@googlegroups.com>.
>              > For more options, visit this group at
>              > http://groups.google.com/group/robotium-developers?hl=en
>             <http://groups.google.com/group/robotium-developers?hl=en>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Robotium Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/robotium-developers/-/sVJqnEzeNEMJ.

> To post to this group, send email to robotium-developers@googlegroups.com.


> To unsubscribe from this group, send email to

Reply all
Reply to author
Forward
0 new messages