Run appium server programmatically using java

As we already got to know from our earlier post Appium test run,  always run appium server  / appium GUI before running your appium test.

While running automated tests, we have to manually run the appium server / GUI first.

Problem:

let’s say that we have to schedule our appium tests to run (may be a nightly build test) and we won’t be at desk or office to run the appium server first.

Solution:

We can write a java code block to run the appium server before running our actual appium test, then we need to do anything manually.

 

Update, if you are using appium-desktop v1.4.x or appium v1.7.2 onwards

From appium-desktop v1.4.x onwards, appium installing under –

c:\Users\<Uname>\AppData\Local\Programs\appium-desktop\

Prerequisites:

  • You should install node.exe [from nodejs.org]
  • Maven dependency for appium

  • Appium-desktop or appium should be installed, find links below [Appium-desktop installation is recommend ]

Appium-desktop download – https://github.com/appium/appium-desktop/releases

Only Appium download – https://github.com/appium/appium/releases

Code implementation

 

For older version of appium

Prerequisites:

  • Download and install appium.exe (refer step6 of appium setup)
  • Install node.exe (refer step7 of appium setup)
  • Jar file – you may get error while running the appium programmatically, validator or lang3 error, include these below jars in to your project

commons-validator-x.x.x.jar – download here

commons-lang3-x.x.jar – download here




Let’s see how we can achieve this – 

below code will automatically run the appium server and after run the appium test.

You can provide path for AppiumServerlog.txt as per your local drive path, I mentioned the project folder path.

 

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: