Fail to start uiautomator2 by Appium on Android 3rd emulator when running a full pipeline on Jenkins

35 Views Asked by At

In my pipeline script, I use this command to start my Android UI automation on a 3rd party emulator.

".\\gradlew cucumber -Pargs=\"-rerun ${rerun_times} -enable-report ${enable_report} -timezone GMT+08:00 -suite ${running_scope}\" -b android\\build.gradle && exit %%ERRORLEVEL%%"

this command would invoke couple Gradle tasks: enter image description here

and my full pipeline has several stages, looks like: enter image description here

I put the above command in the last stage - Initiate AT, I don't see anything in the 4 stages before would affect AT running enter image description here

My issue is: When I run the full script on pipeline project 1, I can see Appium Settings apk flashing on the screen (that often means Appium server started), then nothing happened, here's the log enter image description here

I tried to separate the command and run it alone in pipeline project 2 enter image description here

I can see my debug app running successfully after Appium Settings apk flashing, here's the log I expected enter image description here

Can somebody help, I only start to use Jenkins pipeline this month, and I'm really confused.

1

There are 1 best solutions below

1
Cecilia Chen On

I broke up each stage in the script and reassembled them with the Gradle command, finally I proved my point of 5 stages having nothing to do with each other, And I found the origin of the issue. What caused my problem was an environment variable I set up in environment block, HTTP_PROXY, I didn't know it also is what Appium will be using when it invokes uiautomator2, I still don't know, it's just my guess.