Question 1:
How do I cut down text
execution time for my selenium tests? I want to execute my tests on a
combination of different machines and browsers.
Answer
Selenium grid is your
friendJ. Selenium grid lets you distribute tests across
browsers and machines of your choice.
Question 2:
Question 2:
How does Selenium grid
works?
Answer
Selenium grid uses
combination of Selenium RC servers to execute tests in multiple browsers on
different machine. Herein one Selenium RC server works as hub while other RC
servers work as slaves, which could be controlled by hub. Whenever there is a
request for a specific configuration for test execution then hub looks for a
free RC slave server and if available then test execution begins on it. Once
test execution is over then RC slave server would be available for next set of
test execution.
Question 3:
Can you show me one
diagram which describes functionality of Selenium grid?
Answer
In the following diagram
Selenium hub is controlling three Selenium RC servers which are running for
configurations –
·
IE on Windows
·
FF on Linux
·
FF on windows
Question 4:
Which jar files are
needed to works with Selenium GRID?
Answer
You need to download and
add following jar files to your Selenium set up to be able to work with
Selenium. These jar files are –
·
selenium-grid-remote-control-standalone-.jar
·
selenium-grid-hub-standalone-.jar
·
selenium-grid-tools-standalone-.jar
Question 5:
How do I start Selenium
Grid hub from my machine?
Answer
You should have “ant”
set up on your system to be able to work with Grid. Once you have downloaded
Selenium Grid, navigate to its distribution directory and execute following
command -
ant launch-hub
This would start grid
hub on port 4444 locally. You can verify this by navigating to following URL -http://localhost:4444/console
Question 6:
How do I start Selenium
Grid Slave Server from my system?
Answer
Navigate to download
directory of Selenium gird and execute following command –
ant
launch-remote-control
This would launch remote
control server at port 555. At this point if you navigate to http://localhost:4444/console then you would see this remote control
listed under “Available Remote Controls”
Question 7:
How do I start Selenium
grid slave on a different port than 5555?
Answer
You can use option
“-Dport” followed by port number to start grid slave on a specific port.
ant -Dport=1111 launch-remote-control
ant -Dport=2222
launch-remote-control
Question 8:
How do I start grid RC
slaves on a different system than my local host so than hub could control and
contact a specific configuration?
Answer
You should specify
following configuration while starting RC slave –
ant
-Dport= -Dhost= -DhubURL= launch-remote-control
Herein “hostname” is the
host where RC slave is running and “hub url” is URL of machine where grid hub
is running.
Question 9:
How do I specify an
environment while starting grid slave machine?
Answer
You could specify an
environment using “-Denvironment” while starting a slave machine.
ant
-Denvironment=”Safari on Mac” launch-remote-control
Herein Safari on Mac is
the environment which would be used to recognize configuration of RC slave.
Question 10:
How do I use machine
specific configuration in my Selenium tests?
Answer
You could specify
machine specific configuration while instantiating Selenium as –
Selenium = new
DefaultSelenium("localhost", 4444, **'Safari on Mac'**, 'http://yahoo.com');
And then you use this
selenium instance to carryout operation on your web application.
Question 11:
But how does my tests
know that ‘Safari on Mac’ mean a safari browser? How does mapping between names
like ‘Safari on Mac’ and original browser options available in Selenium work?
Answer
Selenium grid uses a
file called “grid_configuration.yml” which defines configurations of all
browsers. You would have to add this in your project. This file looks like –
Question 12:
How does Selenium grid
hub keeps in touch with RC slave machine?
Answer
Selenium grid hub keeps
polling all RC slaves at predefined time to make sure they are available for
testing. If not then Selenium hub disconnect any unavailable RC slaves and
makes it clear that any RC slave is not available for testing. The deciding
parameter is called – “remoteControlPollingIntervalInSeconds” and is defined in
“grid_configuration.yml” file.
Question 13:
My RC becomes
unresponsive at times and my Selenium grid hub keeps waiting for RC slave to
respondL. How do I let hub know to give up on RC slave
after a certain time?
Answer
You could state Selenium
grid hub to wait for RC slave for a predefined time, and if RC slave does not
responds with in this time then hub disconnects test execution on that slave.
This parameter is called “sessionMaxIdleTimeInSeconds” and this parameter can
be defined in “grid_configuration.yml” file.
Question 14:
What if my hub goes down
while Selenium RC slaves are up and running?
Answer
There is one heart beat
mechanism from RC slave to hub which is reciprocal to mechanism used by hub to
slave machines. RC slaves use a parameter called “hubPollerIntervalInSeconds”
to keep track of running grid hub. This parameter can be defined while starting
the hub as –
ant -DhubPollerIntervalInSeconds= launch-hub
if hub does not respond
within this time then RC slaves deregister themselves from hub.
Question 15:
Can Selenium grid be
used for performance testing?
Answer
Selenium grid is for
functional testing of application across different configuration. Performance
testing is usually not carried out on actual devices but on a simulated http
request/response mechanism. If you want to use Selenium Grid for performance
testing then you would have to invest heavily on s/w and h/w infrastructure.
Question 16:
Are there additional
logs available while working with Selenium grid?
Answer
You can find Selenium
grid hub logs in “log/hub.log” and Remote Control logs in “log/rc-*.log”
folder.
Question 17:
There are various
options available while starting a Selenium server, how do I use them with
Selenium grid?
Answer
You can use “seleniumArgs” Java property while launching the remote control
and specify any of the option which you would with normal Selenium set up. For
example you can run Selenium RC slave in single window mode using following
command –
ant
-DseleniumArgs="-singleWindow -debug" launch-remote-control
Question 18:
I see duplicate entries
in my hub console, same RC slave listed more than once :-O
Answer
This is because you are
killing RC slave very ferociously. For example you if you just close the
console without actually ending the process in more civil manner. To avoid this
you should kill all RC slaves in more civil manner. If you encounter this error
then you should restart Selenium hub and RC slaves would them register
themselves to hub.
Question 19:
How do I specify my
corporate proxy while starting Selenium grid hub or slave machines?
Answer
You could use setting
for “http.proxyHost” abd “http.proxyPort” while starting hub and remote control
machines –
ant
-Dhttp.proxyHost= -Dhttp.proxyPort= launch-hub
ant
-Dhttp.proxyHost= -Dhttp.proxyPort= launch-remote-control
Question 20:
How do I use Selenium
Grid while using Java, .Net or Ruby
Answer
With java you can take
advantage of parallel testing capabilities of TestNG to drive your Selenium
grid tests
With .Net you can use
“Gallio” to execute your tests in parallel
With Ruby you can use
“DeepTest” to distribute your tests
Question 21:
How about the test
report when I use Selenium grid for test execution?
Answer
This entirely boils down
to framework you use to write your tests. For example in case of java, TestNG
reports should suffice.
No comments:
Post a Comment