Parallel execution in grid - selenium

While executing tests in parallel which are in different packages, we are getting an error.The two browsers will launch, but while executing one test will execute while other browsers will lose focus.
Kindly help to resolve

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

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.

Robotium : Test cases are skipped while executing robotium scripts

I am using robotium, i am facing an issue while executing test scripts. My Entire test suite takes 3- 4 hrs of execution, The issues faced are as follows:
Some of the test cases are skipped while execution.
Device gets disconnected and reconnected multiple times while execution is in progress.
Observed the above issues on multiple devices.
Any one facing similiar issue any solution for this ?

In Jenkins build flow plugin, terminate all parallel jobs if one of them failed

We are using the jenkins build flow plugin(https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin) to run our test cases by dividing them into small sub test cases and test them in parallel.
The current problem is even one of the job fails, the other parallel jobs and the hosting flow job will continue running, which is a big waste of resources.
I checked the doc there is no place to control the jobs inside the parallel {}. Any ideas how to deal with that?
Looking at the code, I don't see a way to achieve that. I would ask the user mailing list for help.
I am thinking to use Guard / Rescue imbedded in Parallel to do this.
Adding failFast: true within parallel block would cause the build to fail as soon as one of the parallel nodes fails.
You can view this as an example.