Driver value getting as 'null' in consecutive test classes

I have two Android devices connected and need to execute two devices in parallel. If I declare the driver as static in Base class it will override and stop execution in one device and failed the parallel execution. So I have declared the driver as non-static variable in Base class and extended in my two test case classes

Say ‘LandingTest’ and ‘LoginTest’

driver value getting successfully in LandingTest class for running the scripts whatever that written in LandingTest class but the driver value getting ‘null’ in my second class ‘LoginTest’.

How can I solve this problem?

My Requirement is to run the test classes and scripts in parallel in two connected devices.

Could you please share me the idea how to resolve this situation?

@pr4bh4sh @auto-geek

Thanks,
Sanoj

Can you make narrow down problem, try to do same for same device, reason behind that if its matter of static and non-static, that could be identify with single device only… If that works fine than proceed with parallel execution. Well i m running two devices (Android + IOS ) parallel and never faced such problem so it also matter how you design your automation.

@Priyank_Shah I have tried in two android devices. One condition like my driver is not static.

It get executed all the test cases inside the First class but not working in Second class (here getting driver value as null).

Are you using static driver value?

Please share me the flow of your logic?

Thanks,
Sanoj

I hope when you say First class and Second class that means One test class and Second test class, right? For each run, are you initiate driver in before class method ??

@Priyank_Shah

First class:

public class TestLogin extends TestBase {

@Test
public void login() throws InterruptedException {


}
}

Second class:

public class TestLogout extends TestBase {

@Test
public void logout() throws InterruptedException {


}
}

Are you using two separate Appium server instances? Appium can only run one session per instance, and one session can only run on 1 device/emulator/simulator at a time. If you’re second test case tries to instantiate an Appium session on the same server as the first case’s session when the first case is still running, the second test case might* be encountering an Exception that’s causing it to fail.

What happens if you try to run the tests serially instead of in parallel?

*I haven’t tried running multiple Appium sessions simultaneously yet.

@sanoj27 can you try https://github.com/saikrishna321/AppiumTestDistribution. It takes care of all the server startup and driver creation part. You can connect any no. of devices( not sure about the limit) it will start that no. of appium server and execute the test cases on all the devices.

If you want to make your existing code working please share your suite xml and stack trace as well as the Appium logs.

@afwang Thanks for the reply
@pr4bh4sh

I haven’t tried running two instances. I have running one appium instances and trying to access driver value in two separate classes (TestLogin and TestLogout) as mentioned above. First class getting the driver but when test case execution completed in First class, the second class didn’t get the driver value (it getting as ‘null’). As I mentioned above, I am not declared the driver as static in base class because I need to run the scripts in parallel using two devices. If I declare the driver as static the execution get failed all the time (partially execute in device one and execution will stop when second device start execution). So I removed the static concept. In case of non-static declaration if I written all the test cases in First class (TestLogin) it will working parallel in two devices without any issues.

Could you please suggest anyway to get the driver value in second and consecutive classes if I declare the driver as non-static variable?

Here is the testng.xml details:

Appium Logs:

[TestNG] Running:
E:\Panippura\Automation\RVSAutomationTestScripts\testng.xml

Starting Appium Server…
e[36minfoe[39m: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
e[36minfoe[39m: Appium REST http interface listener started on 127.0.0.1:50672
e[36minfoe[39m: [debug] Non-default server args: {“udid”:“4d003e9be03d91df”,“address”:“127.0.0.1”,“port”:50672,“bootstrapPort”:50673,“noReset”:true,“chromeDriverPort”:50674}
e[36minfoe[39m: Console LogLevel: debug
Appium Successfuly Started…
Loading Driver…
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{“desiredCapabilities”:{“appPackage”:“com.zervant.android.views”,“appActivity”:“com.zervant.android.views.ZLandingPageActivity”,“udid”:“4d003e9be03d91df”,“platformName”:“Android”,“deviceName”:“Samsung Galaxy S4”,“version”:“5.1”}}e[39m
e[36minfoe[39m: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_11)
e[36minfoe[39m: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
e[36minfoe[39m: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
e[36minfoe[39m: [debug] Creating new appium session 0c25632a-f9f3-41d7-b856-c77e9a0063a3
e[36minfoe[39m: Starting android appium
e[36minfoe[39m: [debug] Getting Java version
e[36minfoe[39m: Java version is: 1.8.0_11
e[36minfoe[39m: [debug] Checking whether adb is present
e[36minfoe[39m: [debug] Using adb from E:\AndroidDev\android-sdk\platform-tools\adb.exe
e[33mwarne[39m: No app capability, can’t parse package/activity
e[36minfoe[39m: [debug] Using fast reset? false
e[36minfoe[39m: [debug] Preparing device for session
e[36minfoe[39m: [debug] Not checking whether app is present since we are assuming it’s already on the device
e[36minfoe[39m: Retrieving device
e[36minfoe[39m: [debug] Trying to find a connected android device
e[36minfoe[39m: [debug] Getting connected devices…
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe devices
e[36minfoe[39m: [debug] 1 device(s) connected
e[36minfoe[39m: Found device 4d003e9be03d91df
e[36minfoe[39m: [debug] Setting device id to 4d003e9be03d91df
e[36minfoe[39m: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df wait-for-device
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “echo ‘ready’”
e[36minfoe[39m: [debug] Starting logcat capture
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “getprop ro.build.version.sdk”
e[36minfoe[39m: [debug] Device is at API Level 21
e[36minfoe[39m: Device API level is: 21
e[36minfoe[39m: [debug] Extracting strings for language: default
e[36minfoe[39m: [debug] Apk doesn’t exist locally
e[36minfoe[39m: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “rm -rf /data/local/tmp/strings.json”
e[36minfoe[39m: [debug] Not uninstalling app since server not started with --full-reset
e[36minfoe[39m: [debug] Skipping install since we launched with a package instead of an app path
e[36minfoe[39m: [debug] Forwarding system:50673 to device:4724
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df forward tcp:50673 tcp:4724
e[36minfoe[39m: [debug] Pushing appium bootstrap to device…
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df push “C:\Program Files\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
e[36minfoe[39m: [debug] Pushing settings apk to device…
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df install “C:\Program Files\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
e[36minfoe[39m: [debug] Pushing unlock helper app to device…
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df install “C:\Program Files\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
e[36minfoe[39m: Starting App
e[36minfoe[39m: [debug] Attempting to kill all ‘uiautomator’ processes
e[36minfoe[39m: [debug] Getting all processes with ‘uiautomator’
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “ps ‘uiautomator’”
e[36minfoe[39m: [debug] No matching processes found
e[36minfoe[39m: [debug] Running bootstrap
e[36minfoe[39m: [debug] spawning: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.zervant.android.views -e disableAndroidWatchers false
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunnere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrape[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1e[39m
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Loading json…
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
e[36minfoe[39m: [debug] Waking up device if it’s not alive
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“wake”,{}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Client connected
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: wake
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “dumpsys window”
e[36minfoe[39m: [debug] Screen already unlocked, continuing.
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:"/data/local/tmp"}
e[36minfoe[39m: [debug] dataDir set to: /data/local/tmp
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:false}
e[36minfoe[39m: [debug] Getting device API level
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “getprop ro.build.version.sdk”
e[36minfoe[39m: [debug] Device is at API Level 21
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.zervant.android.views/com.zervant.android.views.ZLandingPageActivity”
e[36minfoe[39m: [debug] Waiting for pkg “com.zervant.android.views” and activity “com.zervant.android.views.ZLandingPageActivity” to be focused
e[36minfoe[39m: [debug] Getting focused package and activity
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “dumpsys window windows”
e[36minfoe[39m: [debug] executing cmd: E:\AndroidDev\android-sdk\platform-tools\adb.exe -s 4d003e9be03d91df shell “getprop ro.build.version.release”
e[36minfoe[39m: [debug] Device is at release version 5.0.1
e[36minfoe[39m: [debug] Device launched! Ready for commands
e[36minfoe[39m: [debug] Setting command timeout to the default of 60 secs
e[36minfoe[39m: [debug] Appium session started with sessionId 0c25632a-f9f3-41d7-b856-c77e9a0063a3
e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[36m303e[39me[90m 18896.597 ms - 74e[39m e[90me[39m
e[36minfoe[39m: e[37m–>e[39m e[37mGETe[39m e[37m/wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3e[39m e[90m{}e[39m
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“5.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“appPackage”:“com.zervant.android.views”,“appActivity”:“com.zervant.android.views.ZLandingPageActivity”,“udid”:“4d003e9be03d91df”,“platformName”:“Android”,“deviceName”:“Samsung Galaxy S4”,“version”:“5.1”},“appPackage”:“com.zervant.android.views”,“appActivity”:“com.zervant.android.views.ZLandingPageActivity”,“udid”:“4d003e9be03d91df”,“platformName”:“Android”,“deviceName”:“4d003e9be03d91df”,“version”:“5.1”},“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}
e[36minfoe[39m: e[37m<-- GET /wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3 e[39me[32m200e[39me[90m 11.075 ms - 736e[39m e[90m{“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“5.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“appPackage”:“com.zervant.android.views”,“appActivity”:“com.zervant.android.views.ZLandingPageActivity”,“udid”:“4d003e9be03d91df”,“platformName”:“Android”,“deviceName”:“Samsung Galaxy S4”,“version”:“5.1”},“appPackage”:“com.zervant.android.views”,“appActivity”:“com.zervant.android.views.ZLandingPageActivity”,“udid”:“4d003e9be03d91df”,“platformName”:“Android”,“deviceName”:“4d003e9be03d91df”,“version”:“5.1”},“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}e[39m
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3/timeoutse[39m e[90m{“type”:“implicit”,“ms”:10000}e[39m
e[36minfoe[39m: [debug] Set Android implicit wait to 10000ms
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3/timeouts e[39me[32m200e[39me[90m 3.877 ms - 76e[39m e[90m{“status”:0,“value”:null,“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}e[39m
Driver Successfuly Loaded…
In Script first class>>>>>>>>: Android on LINUX (0c25632a-f9f3-41d7-b856-c77e9a0063a3)
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3/elemente[39m e[90m{“using”:“id”,“value”:“com.zervant.android.views:id/landing_loginbtn”}e[39m
e[36minfoe[39m: [debug] Waiting up to 10000ms for condition
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“id”,“selector”:“com.zervant.android.views:id/landing_loginbtn”,“context”:"",“multiple”:false}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.zervant.android.views:id/landing_loginbtn”,“context”:"",“multiple”:false}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: find
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Finding com.zervant.android.views:id/landing_loginbtn using ID with the contextId: multiple: false
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.zervant.android.views:id/landing_loginbtn]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“1”}}
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3/element e[39me[32m200e[39me[90m 323.132 ms - 87e[39m e[90m{“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}e[39m
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3/element/1/clicke[39m e[90m{“id”:“1”}e[39m
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“1”}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: click
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session/0c25632a-f9f3-41d7-b856-c77e9a0063a3/element/1/click e[39me[32m200e[39me[90m 878.088 ms - 76e[39m e[90m{“status”:0,“value”:true,“sessionId”:“0c25632a-f9f3-41d7-b856-c77e9a0063a3”}e[39m
In Script second class>>>>>>>>null
com.rvsautomation.exception.AutomationException: com.rvsautomation.exception.AutomationException: By.id: com.zervant.android.views:id/usernamenot found
at com.rvsautomation.actions.SendKeyActionHelper.sendKeys(SendKeyActionHelper.java:121)
at com.testscripts.nativeapp.LoginTest.testLogin(LoginTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:822)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1130)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.rvsautomation.exception.AutomationException: By.id: com.zervant.android.views:id/usernamenot found
at com.rvsautomation.actions.SendKeyActionHelper.sendKeys(SendKeyActionHelper.java:116)
… 21 more

===============================================
Suite
Total tests run: 2, Failures: 1, Skips: 0
Configuration Failures: 1, Skips: 0

Thanks,
Sanoj

If I understand your situation correctly, you have a base class where you are initializing a non-static AppiumDriver instance. You have two child classes inheriting from this base class, and each child class implements 1 test.

In Java, every object created has its own set of non-static instance variables. Non-static variables are not shared among objects, so when the first child class instantiates its driver object, it has no effect on the second child class’s reference to the second child class’s driver object.

If you have an initialization method within each child class (or within the base class) for creating the driver object, the second child class will have trouble initializing the driver if the first class did not clean up its session with the Appium server. Did you remember to call the AppiumDriver.quit() method in the first test case before letting TestNG go on to the next test class? Appium will not allow a second automation session if one is already running.

If you don’t have a special initialization step in each class, then the driver reference in the second child class will point to null. You need to pass the driver reference from the first child class to the second child class, and there are a multitude of ways to do this. One way is to make the driver static, but you say you were running into problems with this method (what is the error exactly?). Another way is to have a separate class that manages Appium sessions, and each child class will request a copy of the driver reference from this separate class at the start of their tests.

I think it has nothing to do with Appium. I believe it is issue with test designing, you should not design your test such a way that driver instance depends on previous class…As per your current implementation i can see your Logout depends on Login (That is obvious!!!) so why do not you put login and logout methods in same class… Remember your test method should be atomic, try to avoid minimize dependencies.

I am also facing issue . i have one feature file which includes two scenarios but it is executing only one scenario .Help me to rectify this issue