Selenium Grid + TestNG + Appium + Pseudo Code + Parallel + Multiple Devices

Guys this may be helpful for use:
Parallel Testing.txt (6.0 KB)

Preconditions:
- Non GUI Appium version works correct and is stable.

  1. Install Selenium Grid from http://docs.seleniumhq.org/download/:

  2. Run Grid Hub:

  3. Add two Appium Server Nodes on Grid Hub:

  4. Devices:

  5. TestNG XML file:

  6. The Pseudo Code

2 Likes

This will be interesting to try.
However I can’t see the text file.
Could you paste the content or give a dropbox link?

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

@geophoton,

Thanks for sharing. But the text file can’t be opened. Could you repost please? Thanks.

Alan

@alangithubtrader

@fangmobile

Parallel Testing.txt (6.0 KB)

cant open it. can you paste the text into pastebin.com ?

@geophoton
It is still the same. Can’t open it. May be problem with the forum software.
Anyways I have an general idea about this now and will try it.
Thanks,

Can you try uploading this text file to dropbox and then post the dropbox link here please?

@alangithubtrader
@fangmobile
@Simon_K

What about this?
https://drive.google.com/file/d/0B0BIE-eaeYsqUFFEQV9yYXN6dXM/view?usp=sharing

1 Like

@geophoton
This works! Reading and trying. Thanks!

That’s interesting. i was wondering that can we implement send the specific scripts to the specific machines ?

For example, i have script1 and script2. On the other hand, i have running machine Node1 and Node2. Can we send the script1 to Node1 and send the script2 to Node2 ? Or it can just random send the scripts to the running machines ?

Thanks

@suroit
I am not sure what script you mean, but i will try to answer.
If you have two Nodes AND you need to run your tests on two different machines. (for example - you have connected devices on Mac1, and another on Mac2).
What are your steps then?

  1. You need to run a Grid Server on any machine.
  2. You need to run command to start two nodes for Mac1 and Mac2.
    • First Node will have an IP address of Mac1 and a port were the appium will start working.
    • Second Node will have an IP address of Mac2 and a port were the appium of that machine will start.
      (in the main document i have sent in step 3 we run both nodes on the same machine with local-127.0.0.1 IP. For your case it will be Mac1 Ip address and Mac2 ip address accordingly).
  3. You need then to start an appium on Mac1 and Mac2 with the same port that you mentioned for each machine on each node.
  4. And you may already have mentioned the tests in testng.xml document describing which test script will run on which device.

Now the key point.
When you instantiate the driver you give some Version value and deviceId value.
It is mandatory for versions to be different. Why? Selenium Grid need to know to which Node it needs to stream the current script. This is done by three values “browserName”, “platform” and “version”. The combination of these three SHOULD BE UNIQUE. As for appium node you must leave blank the “browserName” value and the “platform” value for both is “MAC” it is mandatory to set different “version” values to somehow keep the Node uniqueness.
Before each test (BeforeTest annotation) you instantiate a driver/device. Now, when you instantiate the driver defore each test, along with the deviceId you need to send the “version” so the Grid knows on which Node to run this current test.

Summarizing overall:
The code does the following in general:

  1. Reads testng.xml file. Takes deviceId parameter. It will run the tests under this parameter on the mentioned device.
  2. Instantiate appropriate driver. In the capabilities along with device1 you mentioned version1 then it will know that it should invoke node1 that is Mac1 machine correspondingly.
  3. And send the tests related to this device (in fact node version) to this machine.

@fangmobile welcome :wink:

Thanks geophonton. That’s really help

welcome @suroit

I followed your tutorial and I get the following error: Original error: Instruments crashed on startup.

This happens to both tests. I’m using Xcode 7.0 beta 5 with 2 iOS devices. Do you know what might be the issue?

I can run each individually.

I don’t think the parallel test will work for 2 iOS devices on same machine.

1 Like

@geophoton:- Unable to get TestNG.XML file while searching into the project. Also, i have got the following error while running the script. My other script is working fine