2013-07-17 108 views
1

我試圖在Robotium的Linux服務器上測試我的Android應用程序。在服務器上運行Robotium

lt.socialheat.android.tests.SocialHeatTest: 
Failure in testEventToMap: 
junit.framework.AssertionFailedError: View with id: '2131034182' is not found! 
    at com.jayway.android.robotium.solo.Solo.getView(Solo.java:1929) 
    at com.jayway.android.robotium.solo.Solo.getView(Solo.java:1909) 
    at lt.socialheat.android.tests.SocialHeatTest.testEventToMap(SocialHeatTest.java:45) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214) 
    at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199) 
    at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192) 
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190) 
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175) 
    at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555) 
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661) 

簡單視圖未找到異常,但測試在本地模擬器或實際設備上正常運行。作爲服務器的服務器沒有監視器或任何類型的GUI,並且在創建關於使用軟件渲染而不是GLES的AVD時出現錯誤。那麼是否可以在沒有GUI的服務器上運行Robotium測試,以及如何完成這項壯舉?

編輯:

模擬器PARAMS:
的android-17,英特爾ABI
模擬器-avd測試 - 無皮膚-no音頻-no窗口

回答

1

我有一個完全運行在EC2實例之前的Robotium環境,所以我可以向你保證這個壯舉確實是可能的。

你需要做以下事情:

  • 運行一個VNC會話vnc4server, fluxbox),並從那裏運行的模擬器實例。這至少可以擺脫你提到的零顯示困境。
  • 啓動模擬器時添加-noaudio標誌。這是一個奇怪的錯誤,但是仿真器只是在無頭實例啓動時凍結。
  • 模擬器加載完成後(通過adb狀態進行檢查),請記住它始於顯示鎖定屏幕。通過執行解鎖它adb shell input keyevent 82

我記錄了我自己的冒險,在這裏完成它,所以隨時檢查出來。 Robotium EC2 Guide

+0

我會試試,但我正在研究一個我沒有root權限的大學服務器。 – DariusL

+1

'adb shell input keyevent 82' 我覺得這個固定它,測試成功完成。 – DariusL