This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
21 / 137
Jun 2015

Is it Necessary to Start Selenium Standalone Server for Parallel Execution?

I am able to run tests parallel on multiple devices, by giving different udids , appium port numbers with out configuration json files...
Please let me know Is Selenium Hub should be launched for Parallel Execution? and what is the use when it comes to Appium.!!!

Thank you in advance,
Vijay Bhaskar.

  • created

    May '15
  • last reply

    Aug '18
  • 136

    replies

  • 40.8k

    views

  • 49

    users

  • 35

    likes

  • 45

    links

Frequent Posters

There are 136 replies with an estimated read time of 28 minutes.

Oh boy I have no idea. The appium developer team focuses on getting appium to work, and doesn't directly support selenium grid. I've seen posts here of people who are actively using it though.

Sneak peek: We are currently working on a major refactor of the internal architecture of appium, and the new code will make it possible for us to finally implement multiple sessions from a single appium server =D

Thank you @jonahss .Eagarly waiting for the same :smiley:

But i didn't get exact answer about it. Hope will get suggestions for the same.

Thanks,
Bhaskar.

hi basker,

can u please let me know how to write a selenium program should be execute in multiple android devices(for example 2 devices)
can u help me that how to start.

Hi @veeraBrahmachari_K,

1)Start Selenium server as Hub just placing a cmd : java -jar selenium....jar -role hub hubconfig.json
2) Start two appium servers as nodes for two devices as,
i)appium --nodeconfig path\to\nodeconfig1.json -p 4723
ii)appium --nodeconfig path\to\secondconfigfile\nodeconfig2.json -p 4724
3) You can call them through testng.xml as parallel tests.

Regards,
Bhaskar.

hi basker,
really i am telling that i am new to appium
and i did configuration and all i am able to execute one or two programs on emulators and real devices
now my task to execute same program on two devices parallel,, and two different test case have to execute on different devices at same time

please help me how to start and what are the requirements

hi @RISHI_KHANNA ,

If you are running appium from (Appium.exe) path then ,
node appium --nodeconfig path\to\nodeconfig.json -p 4724 -bp 5724

(or) if you're doing from cmd,
appium --nodeconfig path\to\nodeconfig1.json -p 4724 -bp 5724

Note: "path\to\nodeconfig1.json" is where your node configuration json file locates...e.g. D:\file\nodeconfig.json

Json File should like as follows and please made changes according to you and pls let me know whether it works or not :

nodeconfig.txt550 (449 Bytes)

Thanks,
Bhaskar.

nodeconfig.json: This particular json file should come with node.js?
I am unable to locate this on my system

Instead of Node configuration files, you can also write the java junit/testng code pieces and invoke this java test code as parallel execution units. I don't think we require to start the Selenium Standalone servers here. Appium server has nothing to do with Selenium Standalone servers. Once two Appium instances run on two different ports, these will simultaneously test two devices at one time.

Hi,

It should not come with node.js .We have to create json file manually with .json extension.
I guess you might think of package.json (not used for Grid ).
Please save that txt file to json file and use it ,will get it resolved. (Please make sure that Selenium Hub is already in running state).

Thanks,
Bhaskar

Please have a look on the following topic :-

Hi,
I tried setting up the configuration but getting error "Request to register with was unsuccessful."
I tried to create two instances of appium. Started my appium.exe on two different port numbers 4720 and 4730.
Started my grid server using : "java -jar selenium-server-standalone-2.45.0.jar -role hub"
Node server1 : appium --nodeconfig C:\Users\rishi.kumar.khanna\Desktop\nodeconfig1.json -p 4730 -bp 5724

Node Server2: appium --nodeconfig C:\Users\rishi.kumar.khanna\Desktop\nodeconfig.json -p 4720 -bp 5724

nodeconfig.txt148 (411 Bytes) nodeconfig1.txt105 (415 Bytes)

Hi @RISHI_KHANNA ,
Nice to hear that you're trying and almost done...
You have to start Selenium Server as a hub with json file. have a try with the following and they're...
HubConfig.txt257 (329 Bytes)

java -jar selenium-server-standalone-2.45.0.jar -role hub -hubConfig path\to\HubConfig.json

Hope this will get resolved.
Thanks,
Vijay Bhaskar.

Hi,

Thanks for the prompt help. But still facing the same issue. Can you check my both nodeconfig files?One more doubt - while creating nodes from cmd do I need to open the appium.exe on both the ports manually?

Hi,
No need to open GUI mode Appium server because you're already done appium servers with Command Prompt with Json files. I saw your config files and they are fine.
I guess you're giving same bootstrap port number to both nodes.please have a try with different port nums.
-bp 5723 & -bp 5724

Hope will get resolved..!!!
Regards,
Bhaskar.

Its still not working. Throwing error Unexpected token. Find the screenshot- capture.

Also, we I tried creating node without passing bp and port in command line, only one appium instance was registered on hub . For second instace its throwing an error "Pleas make sure only one appium instance is running"
Screenshot- capture2

The error is coming only when you're trying to start another appium server with the same port number...and in the picture you were not given different appium port numbers and bootstrap numbers. Could you please check them once and give --udid XYZZZZZZ along with them if possible.

UDID is for iOS devices..right?

Also, m able to create grid properly now. Thanks a lot.

Now the test case is failing. Throwing null pointer exception

That sounds great.!!!! :wink:
udid means serial number of your andriod device too... just type a command in your cmd prompt "adb devices" , you'll find a unique number for each device that is udid only.Check your log once.

Regards,
Bhaskar.

Successfully created grid and node.
When executed, out of 2 tests 1 of them fail... even though device id is mentioned it is getting executed on another device. Its running only on one device at a time

Throwing an error: org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)

Even though the deviceName is correct and same as mentioned in .json file

Hi @RISHI_KHANNA ,

Please make change "device" as "deviceName" in your nodeconfig.json file ,have a try . it may resolved.But in my case it is working fine with device...

Thanks,
Bhaskar.

Hi Bhaskar,

While running test from testing suite, yes...you can run parallel on local machine.
but is there any way in testing if
1. I want to run test on different machine
2. I want to run test on Different OS (like MAC )

As per my knowledge selenium standalone server used to achieve above points

Hi @Arvind_Patel,

Good Point raised :+1: .
As of now we can run multiple tests on different OS's and machines too for Web based Automation using Selenium (acts Selenium server.jar as both Hub and Node). But consider for Mobile Automation Appium is a Server that can not handle multiple sessions at a time till now .

I haven't done your requirements till now. Apparently, the above comments you're mentioned mayn't possible i guess (i'm not sure). Please check the same with others too and have a look on the following link .


Regards,
Vijay Bhaskar.

Best to use separate VMs one appium server per device. We are working on a appium rewrite which should make this better.

@Arvind_Patel @bhaskar:
Answer to arvind's question : That can be also achieved using parametrization of machine name/machine ip.
just pass machine ip/machine name just like port number and it will run on those machines at the same time.

You need to create variable
String MachineIp=127.0.0.1;
String portNumber=4723;
driver = new AndroidDriver(new URL("http://MachineIp:portNumber/wd/hub"), capabilities);

OOHH man,,,,
parallel execution killing me. :stuck_out_tongue_winking_eye: . though any how i made it but still there is one problem i am facing

i am running two different test parallely on different device
like

  1. 2 appium node running with two devices, ports and josn config
  2. Selenium grid is running and both node registered

Now i am setting capability dynamically (getting parameter from suite file )
ex:
Test1


Test2


when i run suite
its taking devices randomly like sometime test1 runs on emulator and some time on device1

Is there any one facing same issue ?

@bhaskar

Is there any possibility of running a testsuite containing multiple testcases with same appium instance. As when I tried to run a test suite, first testcase ran successfully but failed at second testcase and so on stating A new session cannot be started .. BTW I am trying to run 10 testcase in the same IOS simulator.

I have posted this issue here:

@bhaskar
Hi Bhaskar,

I am trying to run parallel test on different OS by connecting to selenium Hub.
Here is my scenario:

Hub: On Windows machine
Node1: On same window machine as HUB
Node2: On Mac Machine.

I am trying to run on Android devices connected to both the OS.
I am able to run on Windows but on MAC appium is throwing an error "Unable to load node configuration file to register with grid"

Here is my both Node files:

Node1: {
"capabilities":
[
{
"browserName": "Android",
"version":"5.1.1",
"udid":"052d6d76002e47df",
"maxInstances": 1,
"platform":"ANDROID",
"deviceName":"google Nexus 5"
}],
"configuration":

{
"nodeTimeout":120,
"port":4740,
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4740/wd/hub",
"hub": "127.0.0.1:4444/grid/register",
"hubHost":"127.0.0.1",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000,
"maxSession":1

Node2: {
"capabilities":
[
{
"browserName": "Android",
"version":"4.3",
"udid":"4df742b317683077",
"maxInstances": 1,
"platform":"ANDROID",
"deviceName":"samsung GT-N7100"
}],
"configuration":

{
"nodeTimeout":120,
"port":4728,
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4728/wd/hub",
"hub": "10.123.23.123:4444/grid/register",
"hubHost":"10.123.23.123",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000,
"maxSession":1
}
}

By the way, the work we are doing for Appium v1.5 will make it so we will finally be able to have multiple sessions (parallel tests) with just one appium server ^.^