问题
I first ran into this problem when trying to run Robotium UI tests on a MacOS Mini with no monitor. I added Robotium code to test UI clicks on screen, since we want to add some UI automation to our regression testing. The error I get on the Jenkins server is when solo.clickInList(X) is run:
junit.framework.AssertionFailedError: AbsListView is not found!
[exec] at com.jayway.android.robotium.solo.Waiter.waitForAndGetView(Waiter.java:492)
[exec] at com.jayway.android.robotium.solo.Clicker.clickInList(Clicker.java:406)
[exec] at com.jayway.android.robotium.solo.Clicker.clickInList(Clicker.java:388)
[exec] at com.jayway.android.robotium.solo.Solo.clickInList(Solo.java:1081)
[exec] at com.cars.android.robotium.TestApplication.testSearch(TestApplication.java:29)
I found out that Jenkins needs Xvnc plugin to fake a UI so that the emulator can use it. Make sure to check "Show emulator window" in the specific job. Now doing that I currently get this error.
/Applications/RealVNC/VNC\ Server.app :$DISPLAY_NUMBER -localhost -geometry 1280x1024 -depth 24 -SecurityTypes None
I now get this error in Jenkins
Starting xvnc
[workspace] $ "/Applications/RealVNC/VNC Viewer.app" :77 -localhost -geometry 1280x1024 -depth 24 -SecurityTypes None
FATAL: Cannot run program "/Applications/RealVNC/VNC Viewer.app" (in directory "/Users/Shared/Jenkins/Home/jobs/Android/workspace"): error=13, Permission denied
java.io.IOException: Cannot run program "/Applications/RealVNC/VNC Viewer.app" (in directory "/Users/Shared/Jenkins/Home/jobs/Android/workspace"): error=13, Permission denied
回答1:
You don't say whether the Robotium tests work on your local machine, so I don't know whether the Robotium code itself is correct.
But regarding the Xvnc setup, I see a couple of probable issues:
"VNC Viewer.app" sounds like a VNC client, rather than an X11 server.
As far as I know, you can't just run "/Applications/Foo.app" on the command line. You usually need to run the actual binary; something like "/Applications/Foo.app/Contents/MacOS/foo".
来源:https://stackoverflow.com/questions/16573637/robotium-and-jenkins-ui-testing-errors