詹金斯 - 测试运行未能完成

时间:2015-08-07 15:09:52

标签: android jenkins integration-testing

我正在尝试为我的团队的android项目设置Jenkins。在通过IDE运行时,我的所有测试都会一直通过;但是,通过Jenkins测试结果各不相同。构建可能会通过,但大部分时间都会因下面的类似消息而失败,或者构建似乎无限期地运行。

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

为了简化工作,我创建了一个测试项目,其中包含一个带有3个按钮的活动,以排除我在原始项目/测试中可能做过的任何事情。测试示例:

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

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

FYI寻找解决方案让我herehere两者都没有明显的帮助。

  • Mac OSX / Android Studio
  • 测试lib:Espresso
  • 最新和最好的Jenkins /插件

詹金斯

构建环境

  • 使用现有的模拟器
  • 启动时重置模拟器状态
  • 模拟器选项:-no-audio

构建

  • 执行shell: adb shell输入keyevent 82
  • gradle任务:clean build connectedAndroidTest

仿真器

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

目前一切都在我的机器上运行,但最终计划是在专用机器上安装Jenkins。在这一点上,我只想弄清楚我可能会忽视什么。

0 个答案:

没有答案
相关问题