Start and Stop Appium Server programmatically


Start and Stop Appium Server programmatically

In this section we will learn how we can start and stop the appium server through the program for our mobile automation test case.


There are a lot of scenarios where we wanted to execute our appium mobile test either through some CI tools like Jenkins or on some cloud machine, in that case, it is very much important that we are able to start and stop the appium server through code.

For achieving this task we need to mimic the manual step that we usually perform to start our appium server. Before moving further I would highly recommend you to read this blog to know how to set up an appium server through the command line.


As we have already seen that to start appium server through command prompt we follow below steps:

1)    Open command prompt

2)    Execute the below command and hit enter
appium -a ip address -p portnumber on which appium server need to be started for e.g     appium -a 127.0.0.1 -p 4723.



Similarly to stop appium server we can kill the node process from task manager.

Below is the code snippet to start and stop the appium server.


Code to start appium server can be either placed in @BeforeSuite or @BeforeClass in your automation framework.

Similarly, code to stop appium server can be either placed in @AfterSuite or @AfterClass in the automation framework.

Happy Learning :)



SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post