Moving Across two devices using a single iOS/ Android Driver

Hi,

I have some tests which involves interacting between two devices. Is it possible to use a single driver which can move back and forth between devices.

test scenario:
App deployed on two devices, two different user logged into two devices and interact with each other like sending message.

1 Like

Thats possible, but not using same driver.

You will need two appium servers, two active drivers and then query one device with one drive and other device with the other driver. So one test could be deviceA sending a message to deviceB, deviceB confirming he received the message and replying it back.

2 Likes

Yes that possible. As @Telmo_Cardoso mentioned launch two appium servers bonded with two appium drivers and two devices. You need to create something like this.

device1.openChat();
device1.sendMessage(“Hello”);
Assert.assertTrue(device2.readMessage()==“Hello”);

HI Priyank/Telmo

Is it possible to launch two appium servers on same/different mac machine.

Also can you send me the command for launching.

Thanks
Venkatesh

please send me the command two start two appium servers on different ports.

node -p 5001 -bp 4001 &
node -p 5002 -bp 4002 &

will this work on mac?

/Applications/Appium.app/Contents/Resources/node/bin/node -p 5001 -bp 4001 /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js

??

1 Like

I tried below command, it says bad option bp

/Applications/Appium.app/Contents/Resources/node/bin/node -p 5001 -bp 4001 /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js
/Applications/Appium.app/Contents/Resources/node/bin/node: bad option: -bp

If you have appium in path then:

appium -p 4730
appium -p 4731

Will do the trick

I used below command it worked

/Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --port 4725

2 Likes

I could only see this as practical use case for something that has to deal with local ad hoc style features such as beaming. I would never recommend 2 devices in the same test. You should always stick with API and service calls to generate the tests with the device if at all possible. just my 2 cents…

In his case (as in mine) the 2 devices or more are actually mandatory.

The app I test is a chat one, so I need to test different content send/receive 1 to 1 and even 1 to many devices. There are even simultaneous test, like appearing the indication that other users are writing, etc.

I actually started using appium while testing a messaging app. I still used the api’s. You essentially rebuild the way the apps talk to the servers to signal such things and dont need to have a second device. The app sends out signals from one device to a server, the server relays that info to another device. It’s much easier to simulate from a service in your test framework rather than manage 2 devices at the same time for one test. Lets you focus on the test and not the setup when you get a failure

agree with you, but having two devices for chat is more like a practical setup. we need to test the way it works in field.

1 Like

Hi Do You Have any Idea how to switch between the Multiple device from code