Jenkins 在重新启动测试应用程序时停止工作
Jenkins stops job when restart test app
我正在使用 Jenkins、Appium 和 Ant。当我通过终端启动 Ant 测试时,一切 运行 都很顺利。但是,当我通过 Jenkins 调用 Ant 开始测试时,我注意到 Jenkins 强制停止应用程序而不是重新启动它(在真实 Android 设备和 Genymotion 上测试)。
我发现在应用程序重启时日志中有一些奇怪的东西,测试应用程序启动但它被 Jenkins 杀死,如果我通过 Jenkins 启动测试,Appium 服务器响应 DETELE 而不是 GET:
航站楼:
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/xxx/Library/Android/sdk/platform- tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","am","start","-n","com.xxx/im.actor.XXXActivity","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[Appium] New AndroidDriver session created successfully, session d813f8ab-37c1-4f66-8b70-3008eb833c77 added to master session list
[MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webSto...
[HTTP] <-- POST /wd/hub/session 200 3205 ms - 881
[HTTP] --> POST /wd/hub/session/d813f8ab-37c1-4f66-8b70-3008eb833c77/timeouts {"type":"implicit","ms":10000}
[MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",10000,"d813f8ab...
[debug] [BaseDriver] Set implicit wait to 10000ms
[MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/d813f8ab-37c1-4f66-8b70-3008eb833c77/timeouts 200 3 ms - 76
[HTTP] --> GET /wd/hub/session/d813f8ab-37c1-4f66-8b70-3008eb833c77/appium/device/current_activity {}
[MJSONWP] Calling AppiumDriver.getCurrentActivity() with args: ["d813f8ab-37c1-4f66-8b70-3...
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/xxx/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","dumpsys","window","windows"]
[MJSONWP] Responding to client with driver.getCurrentActivity() result: "im.actor.SplashActivity"
詹金斯:
[testng] [debug] [ADB] 1 device(s) connected
[testng] [debug] [ADB] Running /Users/xxxx/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","am","start","-n","com.xxx/im.actor.XXXXActivity","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[testng] [Appium] New AndroidDriver session created successfully, session 464902e9-5406-4d1e-915e-d4fad4e39da8 added to master session list
[testng] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webSto...
[testng] [HTTP] <-- POST /wd/hub/session 200 3865 ms - 881
[testng] [HTTP] --> POST /wd/hub/session/464902e9-5406-4d1e-915e-d4fad4e39da8/timeouts {"type":"implicit","ms":20000}
[testng] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",20000,"464902e9...
[testng] [debug] [BaseDriver] Set implicit wait to 20000ms
[testng] [MJSONWP] Responding to client with driver.timeouts() result: null
[testng] [HTTP] <-- POST /wd/hub/session/464902e9-5406-4d1e-915e-d4fad4e39da8/timeouts 200 4 ms - 76
[testng] [HTTP] --> DELETE /wd/hub/session/464902e9-5406-4d1e-915e-d4fad4e39da8 {}
[testng] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["464902e9-5406-4d1e-915e-d...
[testng] [debug] [AndroidDriver] Shutting down Android driver
[testng] [debug] [ADB] Getting connected devices...
[testng] [debug] [ADB] 1 device(s) connected
[testng] [debug] [ADB] Running /Users/xxxx/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","am","force-stop","com.xxx"]
如果有人能给我任何关于这个案例的建议,我将不胜感激。
我解决了这个问题。使用 Appium 代替 adb 命令重启应用程序功能。
我正在使用 Jenkins、Appium 和 Ant。当我通过终端启动 Ant 测试时,一切 运行 都很顺利。但是,当我通过 Jenkins 调用 Ant 开始测试时,我注意到 Jenkins 强制停止应用程序而不是重新启动它(在真实 Android 设备和 Genymotion 上测试)。
我发现在应用程序重启时日志中有一些奇怪的东西,测试应用程序启动但它被 Jenkins 杀死,如果我通过 Jenkins 启动测试,Appium 服务器响应 DETELE 而不是 GET:
航站楼:
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/xxx/Library/Android/sdk/platform- tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","am","start","-n","com.xxx/im.actor.XXXActivity","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[Appium] New AndroidDriver session created successfully, session d813f8ab-37c1-4f66-8b70-3008eb833c77 added to master session list
[MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webSto...
[HTTP] <-- POST /wd/hub/session 200 3205 ms - 881
[HTTP] --> POST /wd/hub/session/d813f8ab-37c1-4f66-8b70-3008eb833c77/timeouts {"type":"implicit","ms":10000}
[MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",10000,"d813f8ab...
[debug] [BaseDriver] Set implicit wait to 10000ms
[MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/d813f8ab-37c1-4f66-8b70-3008eb833c77/timeouts 200 3 ms - 76
[HTTP] --> GET /wd/hub/session/d813f8ab-37c1-4f66-8b70-3008eb833c77/appium/device/current_activity {}
[MJSONWP] Calling AppiumDriver.getCurrentActivity() with args: ["d813f8ab-37c1-4f66-8b70-3...
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/xxx/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","dumpsys","window","windows"]
[MJSONWP] Responding to client with driver.getCurrentActivity() result: "im.actor.SplashActivity"
詹金斯:
[testng] [debug] [ADB] 1 device(s) connected
[testng] [debug] [ADB] Running /Users/xxxx/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","am","start","-n","com.xxx/im.actor.XXXXActivity","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[testng] [Appium] New AndroidDriver session created successfully, session 464902e9-5406-4d1e-915e-d4fad4e39da8 added to master session list
[testng] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webSto...
[testng] [HTTP] <-- POST /wd/hub/session 200 3865 ms - 881
[testng] [HTTP] --> POST /wd/hub/session/464902e9-5406-4d1e-915e-d4fad4e39da8/timeouts {"type":"implicit","ms":20000}
[testng] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",20000,"464902e9...
[testng] [debug] [BaseDriver] Set implicit wait to 20000ms
[testng] [MJSONWP] Responding to client with driver.timeouts() result: null
[testng] [HTTP] <-- POST /wd/hub/session/464902e9-5406-4d1e-915e-d4fad4e39da8/timeouts 200 4 ms - 76
[testng] [HTTP] --> DELETE /wd/hub/session/464902e9-5406-4d1e-915e-d4fad4e39da8 {}
[testng] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["464902e9-5406-4d1e-915e-d...
[testng] [debug] [AndroidDriver] Shutting down Android driver
[testng] [debug] [ADB] Getting connected devices...
[testng] [debug] [ADB] 1 device(s) connected
[testng] [debug] [ADB] Running /Users/xxxx/Library/Android/sdk/platform-tools/adb with args: ["-P",5037,"-s","192.168.57.101:5555","shell","am","force-stop","com.xxx"]
如果有人能给我任何关于这个案例的建议,我将不胜感激。
我解决了这个问题。使用 Appium 代替 adb 命令重启应用程序功能。