Stop parallel running multiple instances of Appium server

Currently I am using Appium pro edition - 71 as a reference to start and stop local Appium server.

The issue is I am having a scenario where I have to run multiple instances of an Appium server and want to stop that servers at the end of the test execution i.e @Aftersuit
By current implementation as per the blog I can stop only a random one of the Appium server. Any help would be much appreciated. Do we have any way to stop any parallel running all the servers?

how you start all your appium servers in beforeSuite? give more details. Pro #71 only for server example.

I have implemented as to send a different parameters as per the device to the setup.

Parameters({ “udid”, “systemPort”, “platformInfo”, “deviceName” })
public void startServer(final String udid, final String systemPort, final String platformInfo,
final String deviceName) throws IOException {
if(udid.equals(“”)) {
Adriver = getAndroidSetup(udid, systemPort, platformInfo, deviceName);
if(udid.equals(“”)) {
Bdriver = getAndroidSetup(udid, systemPort, platformInfo, deviceName);

AfterSuite(alwaysRun = true) public void tearDownSetup() {
//— Here want to stop above both running servers.

  • getAndroidSetup() will return androiddriver depending upon the passed parameters and set capabilities then return, in that method only I have passed Systemport parameter to server method to start a server as per the #71

@ is removed intentionally.

java-client version is 6.1.0

switch to other logic.

  1. add list of appium services variable
private List<AppiumDriverLocalService> appiumServices;
  1. startServer should return server service. which you will add to appiumServices list
  2. start driver using returned server service
  3. afterSuite just stop all services in appiumServices list

Thanks it worked with your suggested way! :+1: