Testing Multiple Apps in One Device - First session is terminated when second starts

Hello,
I’m trying to use one device and I would like to test two different apps on one device. (Android)
I checked through documentation and according to that configured the necessary settings for appium servers and also for sessions.
GitHub - appium/appium-uiautomator2-driver: Appium driver for Android UIAutomator2 as it states here, for parallel tests systemPort capability should be given differently.

Another post: java - How to open same mobile application with different types of users and switching between them using appium - Stack Overflow

As it is stated here, I also changed Bootstrap port for 2 server instances.

Here is my configuration for Appium Servers: (Started via Appium Desktop App)

Appium Inspector Configurations:
First session is configured to work on 127.0.0.0.1/4724 with systemPort 8202 and second is 127.0.0.0.1/4734 systemPort 8212

1st session: First App

Caps:
    {
      "platformName": "Android",
      "appium:deviceName": "Nokia G20 new",
      "appium:udid": "PT99653AA11B2600974",
      "appium:appPackage": "app_package_here",
      "appium:automationName": "UiAutomator2",
      "appium:appActivity": "app_activity_here",
      "appium:unlockType": "password",
      "appium:unlockKey": "1111",
      "appium:newCommandTimeout": 7200,
      "appium:app": apk_path_here",
      "appium:nativeWebScreenshot": true,
      "appium:clearSystemFiles": true,
      "appium:systemPort": 8202,
      "appium:fullReset": false,
      "appium:noReset": true
    }

2nd session: Second App

Caps:
    {
      "platformName": "Android",
      "appium:deviceName": "Nokia G20 new",
      "appium:udid": "PT99653AA11B2600974",
      "appium:appPackage": "different_app_package_here",
      "appium:automationName": "UiAutomator2",
      "appium:appActivity": "different_app_activity_here",
      "appium:unlockType": "password",
      "appium:unlockKey": "1111",
      "appium:newCommandTimeout": 7200,
      "appium:app": apk_path_here",
      "appium:nativeWebScreenshot": true,
      "appium:clearSystemFiles": true,
      "appium:systemPort": 8212,
      "appium:fullReset": false,
      "appium:noReset": true
    }

Issue description:
When I start the 1st session, everything is fine. Session starts.(2nd server instance already terminates! Why??) Then I’m trying to start 2nd session with a different app. At this point, 1st session got terminated by itself and of course, I can’t take any actions.

Appium Server and App Inspector logs when the problem happens:

What is the problem here? Is it not possible to open up two apps on one device in different sessions?

I also tried different remote ports, localhost address, bootstrap ports and so on. Nothing worked.

Note:

  • Appium Desktop (Server) App version: 1.20.0
  • Appium Inspector version: 2022.9.1

Kind regards,

It will not work on same phone. Parallel means each test with own device.

1 Like

Thanks for the answer!
So, there is no way to test different apps(with different appium sessions) on 1 device?

No. But you can start other app during test or you can close driver and start it again with other app.

1 Like

I see. What I was looking for more like this case:
One device opens up application A and application B. Something is done from app A and then, I can check out some values from other app B.

I thought it was possible at same time. But as you said, only way to do that on 1 device is:
open app A, do stuff
closing session for app A, open app B, do the check,
closing session for app B, open app A, do stuff again, and so on…

I understood correctly right?

correct. with last Appium you can keep apps open without restart while switching driver between them!

it may be important for your test.

Thanks a lot for your help! I will try