I have an automation suite for our native apps on Android and iOS created using Cucumber, Calabash, and Ruby. I'm utilizing a Page Object Pattern to allow for our project to be cross-platform. At runtime, we can specify to load the iOS or Android profile. Fairly standard stuff for native app automation using these tools.

Each scenario requires me to log in with a username and password which I've specified directly in the feature file.

Given I am on the start page
When I tap "sign_in"
And I login with "user1" and "password1"

This works great provided I'm only testing one device at a time. When I log in with "user1" and check that the account is in a specific state (i.e. the shopping cart is empty), then perform and action (add something to the cart) then check that the account state reflects my action (that item appears in the cart), everything works fine.

Problem: When I have two or more devices running side by side that are both using "user1", the first device will oftentimes put the account in a certain state (something is added to the cart) before the second device gets a chance to finish logging in. So when the second device logs in with "user1" the account is in an unexpected state (the item is already added to the cart from the first device) and that test fails on the second device.

Solution: Utilize different accounts for devices running concurrently. Device 1 will log in as "user1" and device 2 will log in as "user2". Separate accounts on different devices don't lead to the account state conflicts caused by actions taken by another device in the pool.

Question: How and where do I specify these different user accounts and how can each device know which user account to use? Is there a separate config file or helper module in my framework that I need to create?

1 Answer 1


This will show you how to run two devices on the same script and give them different inputs. However that will run serial. You may be able to get them to run parallel if you call each action twice specifying the a device each time. So @@app1.performaction() and @@app2.performaction() but I'm not sure about that. The code for perform action defualtdevice.performaction() so I think you should be able to just specify the device manually but I've never tested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.