Run multiple Android tests from a test suit using TestNG xml in a single Appium session

Hi there,

I am trying to run multiple tests defined in a .xml file.

The issue I encounter is that a new Appium session is created for every test included in the .xml file and the tests take too long to execute.

Eg. If I have 4 tests in the test suite Appium will create 4 sessions. When launching the test suit I can see the App starting up and closing 3 times (this takes quite some time) and the actual tests will be performed only after the 4th App start.
I can also see in the Appium log that 4 different sessions are created.

Using newCommandTimeout capability to avoid the sessions to close due to inactivity before actually starting execution.
Starting Appium with –session-override doesn’t help much it even breaks the first 3 tests and only the 4th will be executed.

It’s not a big issue when executing 4 tests but I’m looking forward to having 20-30 tests in a suit. Creating 20± sessions will take very long and it’s not ideal.

Maybe my project isn’t set up correctly or I’m missing a basic setup thing.
Any help would be appreciated.
Thank you in advance.

P.S. I didn’t find any thread on this exact topic.

@TonTro look at selenium grid option. It will help you to run multiple sessions simultaniesly.

I know but I don’t want to run the tests simultaneously yet.

I just want to run multiple tests, one after another in a single Appium session, locally, so I don’t have to wait the time it takes to create too many sessions.

Thx for the reply though :smiley:

you can use testng xml to run the tests in a sequence one after other.

<test name="SingleDeviceTestAppiumDriver">

    <classes>
        <parameter name = "device" value="Android"/>
     	<class name = "com.ac.smokeTest.Android.SmokeTest"/>
        <class name = "com.ac.Android.Test218"/>
        <class name = "com.ac.Android.Test583"/>
        <class name = "com.ac..Android.Test205"/>

    </classes>

@TonTro you need to provide more details about your problem. Is it android or iOS? Do you start each your test with full-reset capabilities? Are you testing with real device or simulator? When you start driver in testNG (beforeMethod i hope)? When you start appium session in testNG?