Is there any way that I can bypass Selenium Grid's auto-selection process? - selenium

My Situation:
I have 60 dedicated selenium nodes that I use, in AWS. My Selenium Grid and all my Selenium Nodes are in the AWS. (cuts down network requests)
My Problem:
I am experiencing an issue when executing my regression suite. I run only 4 tests at a time due to our nightly servers only being able to handle so many tests going at it at once. The problem that i've diagnosed is that when using t1.micro instances, the CPU tops off when launching only 1 test per 1 node. I keep getting several timeouts. Fine. I can easily upgrade these to m1.small but it makes me think more about the way that the selenium grid selects it's nodes. Per my understanding, this is a quick getup on how the hub handles it's nodes.
So if we only have 4 tests running at a time, it will select the first four nodes. Once these nodes are finished running the tests, it will launch another test against the same instances. Is there any way that I can bypass this logic to just select a random available node rather than "the next one in queue"? I'm noticing that the X amount of nodes after the four nodes are NEVER being utilized.
Sidenote:
I have 60 nodes because this grid will have several different types of regression suites against it. Not only mine.
Edit (July 25, 2015)
A pull request was created for this functionality: https://github.com/SeleniumHQ/selenium/pull/832

This pull request should fix the issue
https://github.com/SeleniumHQ/selenium/pull/832

Related

How can we monitor the data for test execution on different nodes in a distributed execution on Selenium grid setup on local VMs?

I need some help on the below query:
Currently we are using local VMs for Selenium grid execution. (Migration is happening from Selenium 3 to 4 but currently Docker is not in scope of things. )
The question is how can we create a sort of monitor to get the data of which test case is being executed on which node, the current status of the test cases executed to understand how many have passed/failed and how many are pending. Is there any readily available solution or any kind of plugins or open source library to achieve this?

how to run my selenium script on multiple servers at the same time so that i would saved one by one execution time?

how to run my selenium script on multiple servers at the same time so that i would save one by one execution time ?
Scenario: I have 1 hour of total testing time and 20 servers to test and 1 test script takes about 30mins to execute so i want to run my test script simultaneously on all 20 servers in order to save time.
The answer to your question is parallel execution
There are multiple ways to achieve this like 1> Creating a Jenkins Job, Registering all the server machines as slave and executing jobon servers
Or
2> A comparitively simpler and more widely used concept, using Selenium Grid
To Implement Selenium Grid ( for instance with java as a programming language and TestNG framework) we need to take care that
A. we have implemented Threading for our webdriver, so that each execution works on its own driver instance.
B. We have our Testng.xml with attribute set as parallel=tests
You can easily get step by step guide to establish selenium grid to summarize it, We have one machine as hub(master), we have multiple machines or nodes(slave) registered to the hub, your automation code is supplied to the hub, Hub routes test on multiple nodes keeps track of individual execution and gets you the result on the Hub machine itself

Is there a way to schedule the shutdown of Selenium nodes without breaking tests?

I have set up a Selenium Grid with 3 different servers running nodes as windows services. I need to restart those machines regularly to avoid memory leaks and under performance. To do this I need to schedule a job to shutdown the nodes on a server and restart while tests would be pushed to the remaining servers. Then repeat the same process with scheduled jobs on the other servers.
Is there a way to shut down a selenium node once the current test finishes ? Or to get the status of a particular node so I can check each one myself in a scheduled job to make sure the node is not running a test before I shut it down ?
You could check the number of active sessions by requesting each node with the /sessions command:
http://127.0.0.1:4444/wd/hub/sessions
Response :
{"state":"success","sessionId":null,"hCode":3217742,"value":[],"class":"org.openqa.selenium.remote.Response","status":0}
#Sh3mm
Sometime back I wrote up a blog post which basically talks about how to go about building a "Self Healing Grid" which is what you essentially are after.
You can read through my blog post on that from here.
We essentially used the same approach when we working on building the SeLion Grid. The SeLion Grid packs in a few more sophistications. Read more about it here
There's another flavor of essentially the same sort of functionalities that was built by GroupOn as part of their Grid Extras. You can take a look at it here

How to smoothly execute mulitple Selenium scripts on a single machine at a given time

I execute automation Selenium Scripts on remote machine which is set to perform 5 jobs at a time (5 scripts can be executed at a time by instantiating 5 browser instances).But everytime atleast 1 or 2 random scripts fail with random errors such as null pointer exception, Element not visible or not able to click the element. But it won't happen if only 3 jobs are run at a time. What's the best way i can prevent the scripts from failing.
very vague question. Cant really comment on why they are failing without seeing the implementation of classes.
It can happen for a lot of things including latency in network when you are running 5 instances. If that is the case you might considering using selenium grid and distribute your tests across 2 or more nodes in each of which you can run 3 instances.

Distributing requests to Selenium Grid RC's?

I've got a situation here where I have a central selenium grid hub, and several RC's running on my gogrid account. When I access it to run tests, it basically queues all the incoming test requests and executes them serially on only one of the RC's, instead of spreading them out to use available RC's. The tests come from multiple projects, so I'm not looking to parallelize the tests themselves, just to split the requests that come from multiple projects across the multiple RC's. From everything I've read, it seems like selenium grid should be doing this already, yet I only see one RC used to run every single test. Is there something I'm missing?
Do you have multiple RCs registered with the same environment? Each worker can currently only broadcast one environment and the hub assigns work to workers in a circular queue fashion (first registered gets work first).
http://selenium-grid.seleniumhq.org/configuring-and-tuning.html