Jenkins - Test run failed to complete

I am trying to set up Jenkins for my android projects. All my tests will run sequentially as they go through the IDE; however, Jenkins benchmark results vary. The build can go through, but most of the time, it will either fail with a similar message below, or the build will run indefinitely.

com.example.simpletest.MainActivityTest> testButton1Action [Android SDK built for x86 - 5.0.2] [31mFAILED [0m
    java.lang.RuntimeException: Could not launch intent Intent 
{act = android.intent.action.MAIN flg = 0x10000000 cmp = com.example.simpletest / .MainActivity}
within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time?
There could be an animation or something constantly repainting the screen. Or the
activity is doing network calls on creation? See the threaddump logs. For your reference
the last time the event queue was idle before your activity launch request was 1438954385239
and now the last time the queue went idle was: 1438954385249. If these numbers are the same your activity might be hogging the event queue. at android.support.test.runner.MonitoringInstrumentation.startActivitySync (MonitoringInstrumentation.java:315) Tests on Android SDK built for x86 - 5.0.2 failed: Test run failed to complete. Expected 8 tests, received 4 : app: connectedAndroidTestDebug FAILED

To keep things simple, I created a test project containing an activity with 3 buttons to exclude anything I might be doing in my original project / test. Test example:

@SmallTest
public void testButton1() throws Exception {
    Button btn = (Button) getActivity().findViewById(R.id.myButton1);

    assertTrue("Incorrect button 1 text!", btn.getText().equals("Button1"));
}

      

FYI searching for a solution led me to here and here , neither of which helped explicitly.

  • Mac OSX / Android Studio
  • Test lib: Espresso
  • Latest and best for Jenkins / plugins

Jenkins

Build environment

  • Using an existing emulator
  • reset the state of the emulator at startup
  • Emulator options: -no-audio

Build

  • executing shell: adb shell keyevent 82
  • gradle tasks: clean build connectedAndroidTest

Emulator

Name: Nexus5_21-Jenkins
CPU/ABI: Intel Atom (x86)
Path: /Users/someuser/.android/avd/Nexus5_21-Jenkins.avd
Target: Android 5.0.1 (API level 21)
Skin: nexus_5
SD Card: 100M
Snapshot: no
hw.lcd.density: 480
hw.dPad: no
avd.ini.encoding: UTF-8
hw.camera.back: none
disk.dataPartition.size: 200M
hw.gpu.enabled: yes
runtime.network.latency: none
skin.dynamic: yes
hw.keyboard: yes
runtime.network.speed: full
hw.device.hash2: MD5:2fa0e16c8cceb7d385183284107c0c88
hw.ramSize: 1536
tag.id: default
tag.display: Default
hw.sdCard: yes
hw.device.manufacturer: Google
hw.mainKeys: no
hw.accelerometer: yes
hw.trackBall: no
hw.device.name: Nexus 5
hw.sensors.proximity: yes
hw.battery: yes
AvdId: Nexus5_21-Jenkins
hw.sensors.orientation: yes
hw.audioInput: yes
hw.camera.front: none
hw.gps: yes
avd.ini.displayname: Nexus5_21-Jenkins
snapshot.present: no
vm.heapSize: 64
runtime.scalefactor: auto

      

Everything is currently working on my machine, but ultimately the plan was to install Jenkins on a dedicated machine. For now, I'm just trying to figure out what I can ignore.

+3


source to share





All Articles