Appium tests run locally, fail in Jenkins (Error: Killing process XXXX failed: Operation not permitted)

Appium version: 1.6.4

I am trying to run my Appium tests through Jenkins, and I’ve come across an error that I do not know how to resolve.

I am only trying to get this working on a computer that we’re using as a build machine. Initially, I started the Appium server on that machine, then successfully ran my tests though Jenkins. I then updated my tests to start the Appium server programmatically. This works fine for the most part, but I sometimes find that I have to delete the “target” folder in order for my Maven project to be built. I thought that including the maven-clean-plugin in my pom.xml file would take care of that issue, but it did not.

If I delete the “target” folder and run my Appium project through Jenkins, the result is an unstable build. Here is a gist that shows exactly what I’m seeing in my logs: Jenkins_Appium_log

To summarize, I’m getting the following error when I run tests via Jenkins after updating my Appium tests to kick off the Appium server programmatically:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: 
    Error: Killing process 2357 failed: Operation not permitted
        at Promise.all.then (/usr/local/lib/node_modules/appium/node_modules/fkill/index.js:41:10) (WARNING: The server did not provide any stacktrace information)

(I also don’t understand why the target folder needs to be deleted, so any insight into that would be greatly appreciated as well.)

Thanks for reading!

@chiwhitesox56 how you start jenkins slave? I am starting via WEB start and have zero problems. Mine slaves are macMinis.

I have following observations.

It may not be a configuration problem because it also say NULL Pointer Exception
Can you check if appium server started or not by checking this url status
http://127.0.0.1:4723/wd/hub/status

AppiumDriverLocalService service = AppiumDriverLocalService
.buildService(
new AppiumServiceBuilder()
.usingDriverExecutable(new File(“C:/Program Files/nodejs/node.exe”))
.withAppiumJS(new File(“C:/Users/Desktop/android/AppiumForWindows-1.3.4.1/Appium/node_modules/appium/bin/appium.js”))
.withLogFile(new File(“C:/Users/AppiumServerLogs.txt”))
.withArgument(GeneralServerFlag.UIID, “dddd”)
.withIPAddress(“127.0.0.1”)
.usingPort(4725)
);

	service.start();
	**if(service.isRunning())**

** System.out.println(“Appium server started successfully”);**

Instead of using plugin you can ask jenkins to run this maven command
mvn clean install - This one command will remove target folder + update any dependencies if required + Run tests.

1 Like

@Aleksei - I haven’t set up any slaves yet. For now, I’m trying to set up and run the Jenkins automation job on my machine. (I figured I’d work on that after I knew that I could successfully run my Appium tests via Jenkins.)

I figured that it was okay to do this because neither of the tutorials that I used for reference covered the setup of slaves. I followed and modified the steps from Tutorial 1 and Tutorial 2.

I hope I’ve answered your question. Thanks for your help!

@amitjaincoer191

After the logs from my test indicated that the Appium server had been started, I checked http://127.0.0.1:4723/wd/hub/status and saw the following result:

{
     status: 0,
     value: {
          build: {
               version: "1.6.4",
               revision: null
          }
     },
     sessionId: null
}

Regarding the null pointer exception: I believe this happening because the app is not loading, and therefore the username field on the login page of my app is not being found. I do not see this exception when running tests locally.

I haven’t addressed the second part of your comment yet because I just re-ran the test on Jenkins and it is now working. I am happy about this, but also confused. :slight_smile:

Thanks for your help!