Jenkins + Appium integration

I want to integrate Appium with Jenkins on mac OS

I am able to Start the appium sever by using the shell command “Appium &” from jenkins , but the problem is until that command is running the control doesn’t get passed to next step in the jenkins job of executing the automation scripts

Did anyone faced the same challenge , and how it can be resolved

just run the server script in background
then you can proceed to trigger client side script

Did you use any correct shell command to browse/navigate you to the folder/directory WHERE your target script is located?

Jenkins has its own workspace, your code will be contained here.

I am able to run both the jobs independently

1 Job : triggering appium
2 Job : Script execution

Could you possibly tell in more details about this one?

Hold on, where did you start ios_webkit_debug_proxy?

We have same config. macmini’s connected as slave. Appium starting in test code with testNG in beforeSuite section.
Before starting appium we do kill process by port where we going to start appium. Just for sure.

Even i have the same issue…

Configuration failure,
if i start Appium programmatically using the program attached in Appiumstart.java file.

ptmt-mac-mini:workspace
Vinay$ java -cp bin:lib/* org.testng.TestNG testngiOS.xml

[TestNG] Running:

/Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/testngiOS.xml

Trying to start Appium
Server

Test cases STARTED and
Testcase details are Test

Test cases SKIPPED and
Testcase details are project

Test cases SKIPPED and
Testcase details are PLANS

Test cases SKIPPED and
Testcase details are QuickSketch

Test cases SKIPPED and
Testcase details are WALLS

===============================================

Suite

Total tests run: 4,
Failures: 0, Skips: 4

Configuration Failures:
1, Skips: 1

===============================================

Passed tests for suite ’
Suite 'is:[]

Failed tests for suite ’
Suite 'is:[]

Skipped tests for suite
’ Suite 'is:[[TestResult name=QuickSketch status=SKIP
method=MMiOSMobileTest.QuickSketch()[pri:3, instance:T.MMiOSMobileTest@5ae9a829]
output={null}], [TestResult name=project status=SKIP
method=MMiOSMobileTest.project()[pri:1, instance:T.MMiOSMobileTest@5ae9a829]
output={null}], [TestResult name=WALLS status=SKIP
method=MMiOSMobileTest.WALLS()[pri:4, instance:T.MMiOSMobileTest@5ae9a829]
output={null}], [TestResult name=PLANS status=SKIP
method=MMiOSMobileTest.PLANS()[pri:2, instance:T.MMiOSMobileTest@5ae9a829]
output={null}]]






If i start Appium
through node from command line in a batch file, it stops at [Appium] Appium REST http
interface listener started on 0.0.0.0:4723 and doesn’t proceed further with my test cases.

Started by user anonymous

[EnvInject] - Loading
node environment variables.

Building in workspace
/Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/​

[​] $ /bin/sh -xe
/Users/Shared/Jenkins/tmp/hudson8130735449869040556.sh

  • cd
    /Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/

  • chmod g+w+x appium.sh

  • sh appium.sh

[Appium] Welcome to
Appium v1.5.3

[Appium] Non-default
server args:

[Appium]
defaultCommandTimeout: 200000

[Appium] app:
‘/Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/src/T/result/MeasuringMaster.app’

[Appium] Deprecated
server args:

[Appium] --app
=> --default-capabilities
‘{“app”:"/Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/src/T/result/MeasuringMaster.app"}’

[Appium] Default
capabilities, which will be added to each request unless overridden by desired
capabilities:

[Appium] app:
‘/Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/src/T/result/MeasuringMaster.app’

[Appium] Appium REST http
interface listener started on 0.0.0.0:4723





JENKINS CONFIGURATION

So, I am building my
project in /Users/Shared/Jenkins/Home/jobs/MMLocalProject/workspace/​

  1. I have created a
    freestyle project

  2. In the build section
    (Execute shell)

If you are staring Appium from the command line on Jenkins, you need to give it ~5-10 secs of sleep time.

Hi Aleksei, Can we install appium on jenkins vm and start appium while executing job?

@anu9 virtual machine should not have much differnce from your work environement. E.g. if you work under windows and VM also is windows then All should be equal. Just install as you did on your machine.

Thanks Aleksei, I am completely new to this, I referred so many blogs but did not get satisfied understanding. Is it possible to provide me a rough sketch on the flow, like how the source is maintained in Git, standard plugins we need to use in jenkins and standard dependencies required to be mentioned in pom.xml of the test project.

Friendly followup, did you guys link any references to how to integrate Jenkins and Appium (in Macbook Pro)? There doesn’t appear to be any good directions online.

@RedChallenger4 add more info: e.g. where is jenkins machine? How you running your tests now? You should bw able start your tests in terminal.

I’m running my Jenkins through localhost. Right now, I could only run them in my Eclipse IDE.

But I plan to run it in my company’s pipeline eventually. The plan is that Jenkins will run Appium Tests (Android or iOS) and output the results in its console logs.

so first step make your tests run from command line. then it will be possible to run them in jenkins.

1 Like

I was able to run it in Command Line.

How may I run the Appium server and execute the Appium-Maven project in one Jenkins job?

Because I got to work when they were both separate Jenkins jobs running. Shell’s mvn command doesn’t work even when I included the configuration in Jenkins.

you can start appium:

  1. with code using whatever (e.g. with Java command line executer or many others)
  2. you can use e.g. Appium service executer -> https://github.com/appium/java-client/blob/master/src/test/java/io/appium/java_client/service/local/ServerBuilderTest.java
  3. finally you can start appium as script pre-build step in jenkins :slight_smile: