I am trying to run 2 different tests on 2 different emulators parallelly. But my execution halts on 1 device as soon as the test on other device is complete.
I am using the below driver setup code
capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“VERSION”, platformVersion);
capabilities.setCapability(“udid”, deviceName);
capabilities.setCapability(“app”, “app.apk”);
capabilities.setCapability(“appPackage”, “xxx”);
capabilities.setCapability(“appActivitiy”, “xxx.HomeActivity”);
capabilities.setCapability(“systemPort”, systemPort);
driver = new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”), capabilities);
And below is my testNG.xml file
<?xml version=”1.0″ encoding=”UTF-8″?>
<suite name=”Parallel Tests” parallel=”tests” thread-count=”2″>
<test name=”Android native app test on Android 12″>
<parameter name=”platformVersion” value=”12″/>
<parameter name=”deviceName” value=”emulator-5554″/>
<parameter name=”systemPort” value=”6666″/>
<classes>
<class name=”LoginTest” />
</classes>
</test>
<test name=”Android native app test on Android 10″>
<parameter name=”platformVersion” value=”10″/>
<parameter name=”deviceName” value=”emulator-5556″/>
<parameter name=”systemPort” value=”8666″/>
<classes>
<class name=”SignUpTest” />
</classes>
</test>
</suite>
I get the following exception
org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
And sometimes this exception as well
org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Source: Read More