情况如下。我创建了一个带有Jenkins 2.32.2的无头Ubuntu 16.04 Docker容器,目前OpenJDK 1.8.0_121以及JDK 7U80(用于构建JDK 7),Android SDK 16、18、23、24和25. <<<<
以某种方式,此设置在我的calabash测试中无法正常工作,因为我总是会收到错误消息,wenn我尝试运行测试。
我安装了Ruby 2.3.1p112并具有以下宝石:
awesome_print (1.7.0)
bigdecimal (1.2.8)
builder (3.2.3)
calabash-android (0.9.0)
cucumber (2.4.0)
cucumber-core (1.5.0)
cucumber-wire (0.0.1)
did_you_mean (1.0.0)
diff-lcs (1.3)
escape (0.0.4)
gherkin (4.0.0)
httpclient (2.8.3)
io-console (0.4.5)
json (1.8.3)
luffa (2.0.0)
minitest (5.8.4)
multi_json (1.12.1)
multi_test (0.1.2)
net-telnet (0.1.1)
power_assert (0.2.7)
psych (2.0.17)
rake (10.5.0)
rdoc (4.2.1)
retriable (2.0.2)
rubyzip (1.2.1)
slowhandcuke (0.0.3)
test-unit (3.1.7)
thor (0.19.4)
在詹金斯(Jenkins)中,我有一项创建并启动带有forowing命令的仿真器的工作:
08:35:13 [android] Creating Android AVD: /root/.android/avd/hudson_de-DE_160_WVGA_android-16_armeabi-v7a_jenkinsandroidemulator.avd
08:35:13 [android] /opt/android-sdk-linux/tools/android create avd -f -a -c 200M -s WVGA800 -n hudson_de-DE_160_WVGA_android-16_armeabi-v7a_jenkinsandroidemulator -t android-16 --abi armeabi-v7a
08:35:14 $ /opt/android-sdk-linux/platform-tools/adb start-server
08:35:17 * daemon not running. starting it now on port 5848 *
08:35:17 * daemon started successfully *
08:35:17 $ /opt/android-sdk-linux/platform-tools/adb start-server
08:35:17 [android] Starting Android emulator
08:35:17 $ /opt/android-sdk-linux/tools/emulator -ports 5754,5755 -report-console tcp:5849,max=60 -prop persist.sys.language=de -prop persist.sys.country=DE -avd hudson_de-DE_160_WVGA_android-16_armeabi-v7a_jenkinsandroidemulator -no-snapshot-load -no-snapshot-save -wipe-data -no-window -force-32bit
08:35:18 emulator: warning: opening audio output failed
08:35:18
08:35:23 [android] Emulator reported that the console is available on port 5,754
08:35:23 [android] Waiting for emulator to finish booting...
08:35:23 $ /opt/android-sdk-linux/platform-tools/adb -s emulator-5754 wait-for-device shell getprop init.svc.bootanim
08:35:23 emulator: UpdateChecker: skipped version check
08:35:42 [android] Emulator reported that the startup process is 'running'
08:35:55 $ /opt/android-sdk-linux/platform-tools/adb -s emulator-5754 wait-for-device shell getprop init.svc.bootanim
08:36:36 [android] Emulator reported that the startup process is 'running'
08:36:50 $ /opt/android-sdk-linux/platform-tools/adb -s emulator-5754 wait-for-device shell getprop init.svc.bootanim
08:36:50 [android] Emulator reported that the startup process is 'stopped'
08:36:50 $ /opt/android-sdk-linux/platform-tools/adb -s emulator-5754 logcat -v time
08:36:50 [android] Emulator is ready for use (took 92 seconds)
之后,工作使用Gradle构建了我的Android项目。APK构建后,Calabash测试应运行,但是我将获得以下输出:
08:41:30 + calabash-android run /var/jenkins_home/workspace/Appname/app/build/outputs/apk/app-debug.apk --verbose --format json --out result.json
08:41:31 No test server found for this combination of app and calabash version. Recreating test server.
08:41:31 [35mDEBUG: Setting Android SDK location to $ANDROID_HOME[0m
08:41:31 [35mDEBUG: Android SDK location set to '/opt/android-sdk-linux'[0m
08:41:31 [35mDEBUG: Set aapt path to '/opt/android-sdk-linux/build-tools/25.0.2/aapt'[0m
08:41:31 [35mDEBUG: Set zipalign path to '/opt/android-sdk-linux/build-tools/25.0.2/zipalign'[0m
08:41:31 [35mDEBUG: Set adb path to '/opt/android-sdk-linux/platform-tools/adb'[0m
08:41:31 [35mDEBUG: Set android jar path to '/opt/android-sdk-linux/platforms/android-25/android.jar'[0m
08:41:31 [35mDEBUG: Setting Java SDK location to $JAVA_HOME[0m
08:41:31 [35mDEBUG: Java SDK location set to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7'[0m
08:41:31 [35mDEBUG: Found java on PATH[0m
08:41:31 [35mDEBUG: Set java path to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/java'[0m
08:41:31 [35mDEBUG: Found keytool on PATH[0m
08:41:31 [35mDEBUG: Set keytool path to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/keytool'[0m
08:41:31 [35mDEBUG: Found jarsigner on PATH[0m
08:41:31 [35mDEBUG: Set jarsigner path to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/jarsigner'[0m
08:41:31 2017-02-22 08:41:31 - Signature files:
08:41:31 2017-02-22 08:41:31 - /tmp/d20170222-4136-1g8arof/META-INF/CERT.RSA
08:41:31 2017-02-22 08:41:31 - "/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/keytool" -v -printcert -J"-Dfile.encoding=utf-8" -file "/tmp/d20170222-4136-1g8arof/META-INF/CERT.RSA"
08:41:31 2017-02-22 08:41:31 - SHA1 fingerprint for signing cert (/var/jenkins_home/workspace/Appname/app/build/outputs/apk/app-debug.apk): DC:DD:67:19:78:DE:43:A1:7E:E8:26:DE:DA:43:78:0C
08:41:31 2017-02-22 08:41:31 - /var/jenkins_home/workspace/Appname/app/build/outputs/apk/app-debug.apk was signed with a certificate with fingerprint DC:DD:67:19:78:DE:43:A1:7E:E8:26:DE:DA:43:78:0C
08:41:31 2017-02-22 08:41:31 - Reading keystore data from keystore file '/root/.android/debug.keystore'
08:41:31 2017-02-22 08:41:31 - "/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/keytool" -list -v -alias androiddebugkey -keystore /root/.android/debug.keystore -storepass android "-J"-Dfile.encoding=utf-8"" "-J"-Duser.language=en-US""
08:41:31 2017-02-22 08:41:31 - Key store data:
08:41:31 2017-02-22 08:41:31 - Alias name: androiddebugkey
08:41:31 Creation date: Feb 21, 2017
08:41:31 Entry type: PrivateKeyEntry
08:41:31 Certificate chain length: 1
08:41:31 Certificate[1]:
08:41:31 Owner: CN=Android Debug, O=Android, C=US
08:41:31 Issuer: CN=Android Debug, O=Android, C=US
08:41:31 Serial number: 5c473d
08:41:31 Valid from: Tue Feb 21 08:48:21 UTC 2017 until: Thu Feb 14 08:48:21 UTC 2047
08:41:31 Certificate fingerprints:
08:41:31 MD5: E4:12:04:8F:43:6F:90:8A:CA:48:41:B8:48:E3:18:CD
08:41:31 SHA1: CE:AA:E1:80:DC:DD:67:19:78:DE:43:A1:7E:E8:26:DE:DA:43:78:0C
08:41:31 SHA256: 50:8E:75:7F:1D:A0:2B:01:49:B2:CF:EB:A1:58:16:C5:2C:22:15:44:67:C9:B9:28:8B:C0:FB:F5:A4:6F:2F:22
08:41:31 Signature algorithm name: SHA256withRSA
08:41:31 Version: 3
08:41:31
08:41:31 Extensions:
08:41:31
08:41:31 #1: ObjectId: 2.5.29.14 Criticality=false
08:41:31 SubjectKeyIdentifier [
08:41:31 KeyIdentifier [
08:41:31 0000: FF 61 B4 C8 D9 85 A2 88 E5 D7 E6 39 58 C1 B5 91 .a.........9X...
08:41:31 0010: 7A 8B 44 88 z.D.
08:41:31 ]
08:41:31 ]
08:41:31
08:41:31 2017-02-22 08:41:31 - Fingerprint: DC:DD:67:19:78:DE:43:A1:7E:E8:26:DE:DA:43:78:0C
08:41:31 2017-02-22 08:41:31 - Signature algorithm name: SHA256withRSA
08:41:31 2017-02-22 08:41:31 - Unlocked keystore at /root/.android/debug.keystore - fingerprint: DC:DD:67:19:78:DE:43:A1:7E:E8:26:DE:DA:43:78:0C
08:41:31 2017-02-22 08:41:31 - Trying to read keystore from: /var/jenkins_home/workspace/Appname/calabash_tests/debug.keystore - no such file
08:41:31 2017-02-22 08:41:31 - Trying to read keystore from: /root/.local/share/Xamarin/Mono for Android/debug.keystore - no such file
08:41:31 2017-02-22 08:41:31 - Trying to read keystore from: /root/AppData/Local/Xamarin/Mono for Android/debug.keystore - no such file
08:41:31 2017-02-22 08:41:31 - Signing using the signature algorithm: 'SHA1withRSA'
08:41:31 2017-02-22 08:41:31 - Signing using the digest algorithm: 'SHA1'
08:41:31 2017-02-22 08:41:31 - "/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/jarsigner" -sigfile CERT -sigalg SHA1withRSA -digestalg SHA1 -signedjar test_servers/3ddf16f67946400b78f7cc84e43884f0_0.9.0.apk -storepass android -keystore /root/.android/debug.keystore /tmp/d20170222-4136-1cudbte/TestServer.apk androiddebugkey
08:41:32 Done signing the test server. Moved it to test_servers/3ddf16f67946400b78f7cc84e43884f0_0.9.0.apk
08:41:32 2017-02-22 08:41:32 - "/usr/bin/ruby2.3" -S cucumber --verbose --format json --out result.json APP_PATH="/var/jenkins_home/workspace/Appname/app/build/outputs/apk/app-debug.apk" TEST_APP_PATH="test_servers/3ddf16f67946400b78f7cc84e43884f0_0.9.0.apk"
08:41:33 Code:
08:41:33 * features/support/env.rb
08:41:33 [35mDEBUG: Setting Android SDK location to $ANDROID_HOME[0m
08:41:33 [35mDEBUG: Android SDK location set to '/opt/android-sdk-linux'[0m
08:41:33 [35mDEBUG: Set aapt path to '/opt/android-sdk-linux/build-tools/25.0.2/aapt'[0m
08:41:33 [35mDEBUG: Set zipalign path to '/opt/android-sdk-linux/build-tools/25.0.2/zipalign'[0m
08:41:33 [35mDEBUG: Set adb path to '/opt/android-sdk-linux/platform-tools/adb'[0m
08:41:33 [35mDEBUG: Set android jar path to '/opt/android-sdk-linux/platforms/android-25/android.jar'[0m
08:41:33 [35mDEBUG: Setting Java SDK location to $JAVA_HOME[0m
08:41:33 [35mDEBUG: Java SDK location set to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7'[0m
08:41:33 [35mDEBUG: Found java on PATH[0m
08:41:33 [35mDEBUG: Set java path to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/java'[0m
08:41:33 [35mDEBUG: Found keytool on PATH[0m
08:41:33 [35mDEBUG: Set keytool path to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/keytool'[0m
08:41:33 [35mDEBUG: Found jarsigner on PATH[0m
08:41:33 [35mDEBUG: Set jarsigner path to '/var/jenkins_home/tools/hudson.model.JDK/JDK_7/bin/jarsigner'[0m
08:41:33 * features/support/app_installation_hooks.rb
08:41:33 * features/support/app_life_cycle_hooks.rb
08:41:33 * features/support/hooks.rb
08:41:33 * features/step_definitions/Custom_Step_Definition.rb
08:41:33 * features/step_definitions/calabash_steps.rb
08:41:33
08:41:33 Features:
08:41:33 * features/registrierung_karteikarten_check.feature
08:41:33
08:41:33 2017-02-22 08:41:33 - connected_devices: ["emulator-5754"]
08:41:33 2017-02-22 08:41:33 - Persistently allocated port 34784 to emulator-5754
08:41:33 2017-02-22 08:41:33 - "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5754 forward tcp:34784 tcp:7102
08:41:33 2017-02-22 08:41:33 -
08:41:33 2017-02-22 08:41:33 - Starting test server using:
08:41:33 2017-02-22 08:41:33 - "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5754 shell am instrument -e main_activity null -e test_server_port 7102 -e class sh.calaba.instrumentationbackend.InstrumentationBackend com.appname.appname2.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
08:41:34 android.util.AndroidException: INSTRUMENTATION_FAILED: com.appname.appname2.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
08:41:34 at com.android.commands.am.Am.runInstrument(Am.java:616)
08:41:34 at com.android.commands.am.Am.run(Am.java:118)
08:41:34 at com.android.commands.am.Am.main(Am.java:81)
08:41:34 at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
08:41:34 at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
08:41:34 at dalvik.system.NativeStart.main(Native Method)
08:41:41 2017-02-22 08:41:34 - It looks like your app is no longer running.
08:41:41 It could be because of a crash or because your test script shut it down.
08:41:41 2017-02-22 08:41:34 - It looks like your app is no longer running.
08:41:41 It could be because of a crash or because your test script shut it down.
在这里,calabash正在工作时logcat输出:
D/AndroidRuntime( 629): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 629): CheckJNI is ON
D/dalvikvm( 629): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 629): Added shared lib libjavacore.so 0x0
D/dalvikvm( 629): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 629): Added shared lib libnativehelper.so 0x0
D/AndroidRuntime( 629): Calling main entry com.android.commands.am.Am
W/ActivityManager( 148): Unable to find instrumentation info for: ComponentInfo{com.appname.appname2.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner}
I/AndroidRuntime( 629): VM exiting with result code 1.
所以我已经搜索了几个小时的解决方案,但似乎没有任何用途。当我尝试手动复制消息时,这里有更多信息。
创建AVD:/opt/android-sdk-linux/tools/android创建AVD -F -A-C 200M -S WVGA800 -N HUDSON_DE-DE_160_WVGA_ANDROID-16_ARMEABI-V7A_JENKINKINKINKINSANDROIDROIDROIDEMUIDATOR -T
开始服务器:/opt/android-sdk-linux/platform-tools/adb start-server
开始模拟器:-no-snapshot-save -wipe-data -no-window -force-32bit
与Jenkins命令的区别在于,模拟器IST startet没有" -Report-Console TCP:5849,Max = 60"之后我运行:calabash-android run app-debug.apk - verbose -format json-out result.json
我得到了相同的输出。我尝试了calabash-android辞职app-debug.apk。另外,使用calabash-android构建的app-debug.apk我仍然获得相同的输出。
我通过calabash-android Console App-debug.apk打开控制台有了我有一个新问题,模拟器被杀死,我从测试服务器中得到了以下答案:
Errno::ECONNREFUSED: Connection refused - Connection refused - connect(2) for "127.0.0.1" port 34785 (127.0.0.1:34785)
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:623:in `rescue in create_socket'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:607:in `create_socket'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:755:in `block in connect'
from /usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
from /usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:1138:in `rescue in protect_keep_alive_disconnected'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:1132:in `protect_keep_alive_disconnected'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'
from /var/lib/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient.rb:765:in `post'
from /var/lib/gems/2.3.0/gems/calabash-android-0.9.0/lib/calabash-android/operations.rb:531:in `make_http_request'
from /var/lib/gems/2.3.0/gems/calabash-android-0.9.0/lib/calabash-android/operations.rb:468:in `http'
from /var/lib/gems/2.3.0/gems/calabash-android-0.9.0/lib/calabash-android/operations.rb:800:in `start_application'
from /var/lib/gems/2.3.0/gems/calabash-android-0.9.0/lib/calabash-android/operations.rb:790:in `start_test_server_in_background'
from /var/lib/gems/2.3.0/gems/calabash-android-0.9.0/lib/calabash-android/operations.rb:152:in `start_test_server_in_background'
from (irb):1
from /usr/bin/irb:11:in `<main>'
在运行模拟器的控制台中输出为以下:
分割故障(核心倾倒)
我还检查了仪器是否有问题,并且我在calabash控制台中进行了Reinstall_Apps,可用的仪器是:
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.android.smoketest.tests/android.test.InstrumentationTestRunner (target=com.android.smoketest)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
Reinstall_Apps之后,如下:
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.android.smoketest.tests/android.test.InstrumentationTestRunner (target=com.android.smoketest)
instrumentation:com.appname.appname2.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner (target=com.appname.appname2)
instrumentation:com.appname.appname2.test/sh.calaba.instrumentationbackend.ClearAppData (target=com.appname.appname2)
instrumentation:com.appname.appname2.test/sh.calaba.instrumentationbackend.ClearAppData2 (target=com.appname.appname2)
instrumentation:com.appname.appname2.test/sh.calaba.instrumentationbackend.ClearPreferences (target=com.appname.appname2)
instrumentation:com.appname.appname2.test/sh.calaba.instrumentationbackend.SetPreferences (target=com.appname.appname2)
instrumentation:com.appname.appname2.test/sh.calaba.instrumentationbackend.GetPreferences (target=com.appname.appname2)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
好吧,似乎所有的logoutput都缺少一个重要的消息。在进行了更多测试之后,我得到了此消息:
`Cucumber::Ast` no longer exists. These classes have moved into the `Cucumber::Core::Ast` namespace, but may not have the same API. (RuntimeError)
现在我知道我的问题是什么。造成麻烦的是错误的黄瓜版。我现在有Cucumber 1.3.20,我至少可以继续进行新的错误,但是现在让我们看看我可以找到的东西。