Appium Base class to Spinup driver for Android & iOS

Hi Community,

I’m new to Appium & trying automate some test cases via emulator & simulators, I have maven,testng,Allure,Appium & java. Running parallel tests for android & iOS.

In each test class I’m creating a driver instance in @BeforeMethod like:

 private AndroidDriver driver = null;

public void SpinUpAndroidDriver(){

    try {
        url = new URL("");
        driver = new AndroidDriver(url, caps);

    } catch (MalformedURLException e) {
        throw new RuntimeException(e);

public void setupDeviceCapabilities(){
    caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
    caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel3");
    caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UIAutomator2");
    caps.setCapability(MobileCapabilityType.UDID, "emulator-5554");
    caps.setCapability(MobileCapabilityType.APP, AppUrl);
    caps.setCapability(MobileCapabilityType.FULL_RESET, "false");
    caps.setCapability("appWaitActivity", "*");


public void StopAndroidDriver() {

& similarly for iOS tests in each test classes creating driver instance like this.

What I want to Achieve

I want to have a base class where I can initiate these driver instances both for android & ios so test classes can call these, looking for some hints/directions/examples to create base class also I hope this will work for parallel execution of tests.

thanks for your support already :pray: