Integration of Appium with jenkins


#1

I am writing my Test Cases using maven project in Intelij IDE framework. I want to run them through jenkins whenever i push a change in git repository. At this moment when i try to build a new jenkins job the scripts fails at the point where driver tries to establish a connection with local host The error is

setUp(scenarios.AppiumTest) Time elapsed: 1.207 sec <<< FAILURE!
org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:4723 [/127.0.0.1] failed: Connection refused (Connection refused)
Build info: version: ‘3.0.1’, revision: ‘1969d75’, time: ‘2016-10-18 09:49:13 -0700’
System info: host: ‘localhost.localdomain’, ip: ‘127.0.0.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.10.0-327.36.2.el7.x86_64’, java.version: ‘1.8.0_112’

other tahn that i have some questions:

  1. Do i need to start appium server by terminal or can i start it in software form ?
  2. Can i run my scripts from jenkins without running appium ?
  3. Do i need to change app path too ?
  4. Do i need to start emulator too manually?

I tried to modify the desired capabilities but really cant get a fruitful result.
i am so confuse about all this process.
For next step i want to run tests on saucelabs using jenkins via git repository. Any help would be appreciated.


#2

have appium with jenkins. we use testNG.

  1. We start appium in code beforeSuite
  2. It is depends where is your build on your machine and on jenkins slave
  3. you can start emulator manually in code too

#3

@Aleksei Can you please tell me how can i start appium server in before suite ?

Right now i just have capabilities in beforeclass and starting appium server via terminal but still jenkins build fails at time of establishing connection with localhost as here

Failed tests: setUp(scenarios.AppiumTest): org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:4723 [/127.0.0.1] failed: Connection refused (Connection refused)(…)

Tests run: 4, Failures: 1, Errors: 0, Skipped: 3


#4

beforeSuite is testNG not JUnit.
@Umme_Ammara how you installed appium on jenkins slave?


#5

I am using jenkins as master machine.

For now i am able to run scripts through giving IP address of my local machine but for that first i have to start appium server manually. what i want to do is just as you said start appium server in beforesuite. i am using TestNG in intelij.
I am not sure how can i start appium server through code and how would i pass the Local IP address to it.

I installed appium via install appium through terminal.


#6

@Umme_Ammara nice! now you are ready to read - Starting Appium server programmatically on MAC

have problem with code - return here