Moving from Selenium IDE to what? - selenium

I have been given the following job from my boss:
three years ago a former employee created selenium tests for our project and committed them via eclipse
now I have to update the tests due to the fact that the software has changed through time.
I created new IDE tests, instead of editing the old ones.
I have committed them through CVS in the project folder and I access them via a browser (selenium has some folder in the project)
when I run these tests via IDE, they run fine, but when I run them via the TEstRUnner that is in the old selenium installation, there are a lot of errors.
Should I install new version of Selenium in the project folder and what should it be?
Or should I just run the tests from IDE instead? (I read somewhere that TestRunner will be deprecated)
How are tests made in IDE run through Web Driver?

Have you looked at Selenium Builder? It supports migrating existing scripts, works well with Sauce Labs and there is also a Jenkins plugin](https://wiki.jenkins-ci.org/display/JENKINS/Selenium+Builder+Plugin) available.

Tests built using Selenium IDE are built using Selenium RC (1.0), and selenium WebDriver is the foundation of Selenium 2.0. Selenium has a migration document for this transition. In moving to Web Driver, you might be required to code the tests yourself, rather than using the point and click Selenium IDE.
Additionally, there is a hybrid approach for using Selenium RC code on Selenium Web Driver: http://docs.seleniumhq.org/docs/03_webdriver.jsp#alternative-back-ends-mixing-webdriver-and-rc-technologies
In order to run the Web Driver tests, you will need to have a selenium server or local browser to execute these tests. Some examples are SauceLabs, Selenium Grid, a standalone Selenium Server, or I believe you allow Web Driver to directly control the browser on the computer executing the code.

Related

Difference between "selenium server" and "selenium server standalone" jars

Can anyone please explain the difference between "selenium server" and "selenium server standalone" jars and use of both.
Which one to prefer?
When to use which one?
As per Selenium Documents,
You may, or may not, need the Selenium Server, depending on how you intend to use Selenium-WebDriver. If you will be only using the WebDriver API you do not need the Selenium-Server. If your browser and tests will all run on the same machine, and your tests only use the WebDriver API, then you do not need to run the Selenium-Server; WebDriver will run the browser directly.
There are some reasons though to use the Selenium-Server with Selenium-WebDriver.
You are using Selenium-Grid to distribute your tests over multiple machines or virtual machines (VMs).
You want to connect to a remote machine that has a particular browser version that is not on your current machine.
You are not using the Java bindings (i.e. Python, C#, or Ruby) and would like to use HtmlUnit Driver.
Here is a photo from the old version of selenium website:
Selenium Server is formerly known as selenium RC server.
I can not say exact selenium server standalone definition, but i can say based on the version
In the selenium server standalone server is different
I believe that "selenium server" jar IS "selenium server standalone" jar. If you look at http://www.seleniumhq.org/download/ - there is not such thing as "selenium server".
Grid and RC servers are in the same jar file. RC ("Remote Control") is deprecated in Selenium 2 and emulated in Selenium 3.
Lazily, "selenium server standalone" can be called just "selenium server", because that's what it is: proxy to selenium grid or whatever remote browsers you want to automate. "standalone" is HTTP server.
http://www.protractortest.org/#/infrastructure hints at difference in terminology: it is "standalone" when running locally, and "server" when running (standalone jar) on remote grid (which is a http server assigning jobs to multiple selenium servers, each running "standalone" jars).
If one enters via the Getting Started page at the Selenium Wiki, there is a download link to selenium-release.storage.googleapis.com. E.g. the 3.8 release directory features:
[DIR] selenium-server-3.8.1.zip 2017-12-01 19:21:38 20.58MB
[DIR] selenium-server-standalone-3.8.1.jar 2017-12-01 19:17:06 21.79MB
So there are indeed two versions. It seems a matter of packaging:
The selenium-server-3.8.1.zip contains a file selenium-3.8.1-nodeps.jar and the dependent classes as .jar files ("jars in zip"):
..
---x------ 63504 1-Feb-1985 00:00:00 libs/jcommander-1.48.jar
..
---x------ 857721 1-Feb-1985 00:00:00 selenium-3.8.1-nodeps-sources.jar
---x------ 2137810 1-Feb-1985 00:00:00 selenium-3.8.1-nodeps.jar
while the selenium-server-standalone-3.8.1.jar contains the dependent classes and its own classes as direct entries ("class files in jar"):
..
-rw-rw-rw- 1014 10-Apr-2015 19:45:56 com/beust/jcommander/DynamicParameter.class
-rw-rw-rw- 237 10-Apr-2015 19:45:56 com/beust/jcommanderFuzzyMap$IKey.class
-rw-rw-rw- 2910 10-Apr-2015 19:45:56 com/beust/jcommander/FuzzyMap.class
..
Selenium is an opensource, web application automation testing tool suite which provides cross platform and cross browser automation facility.
Selenium is composed of multiple software tools that includes:-
(1). Selenium IDE, (2). Selenium RC, (3). Selenium WebDriver, (4). Selenium Grid
Coming to the Selenium Server,
The Selenium Server is a Selenium RC(Remote Control) component that which launches and kills browsers, interprets and runs the Selenese commands passed from the test program, and acts as an HTTP proxy, intercepting and verifying HTTP messages passed between the browser and the AUT(Application Under Test).
So, Selenium Server is needed to run Selenium RC and Selenium WebDriver tests remotely over multiple machines or VMs using Selenium Grid.
And the Selenium Server Standalone is a bundled jar that contains WebDriver API, Selenium Server and the Selenium Grid for running the tests locally and remotely across many platforms and browsers.
The Selenium Server is needed in order to run Remote Selenium
WebDriver. Selenium 3.X is no longer capable of running Selenium RC
directly, rather it does it through emulation and the
WebDriverBackedSelenium interface.
see https://docs.seleniumhq.org/download/
So,if you use Selenium RC,the Seleniium Server is what you need.if you use Selenium 3.X and update,selenium-server-standalone is what you need.I have the same question and i find the answer.

Selenium testing machine

--- TL;DR
At this point I suggest everyone to tied their Continuous Integration server/service to https://ghostinspector.com/
OLD QUESTION
after three days googling and testing I gave up, and I need help.
My objective is allow my co-workers to record one or more tests with Selenium IDE. Export them, upload them into a server, and get this server running these tests using the webdriver with htmlunit. As we build or fix the app, we will upload the tests to make out test library.
Record a test with Selenium IDE is okay. But getting it running is the problem. The machine we intend to let the tests is an linux amazon server. No front-end stuff, no kde, gtk, so no firefox, chrome, etc... This is why I've specified the htmlunit driver.
So far I wasn't able to get this task running even into my machine - Ubuntu 12.04 x86_64.
I downloaded the selenium-server tarball, and tried running:
java -jar selenium-server.jar -htmlSuite "*webdriver" "our.site.org" "/path/to/testsuite1.html" "/path/to/report1.html"
No success. Even changing the "*webdriver" (using other pops-up a browser screen).
I've tried running the server and the standalone server and connecting via browser.
I've tried PHP bindings by facebook.
I've tried PHPUnit and Testing Selenium classes - along with their respectives exported scripts from Selenium Formatters.
I really do not know where I'm slipping. Can anyone give me a safe direction, tutorial, etc, to follow with?
--- EDIT
Okay, my question may be resumed to:
What si the command line that would allow me to run selenese scripts with selenium-server, using the HtmlUnit driver?
Are you using Continuous Integration?
If so, you should consider getting a plugin to have your CI software run the Selenium tests. Works like a charm for me with Jenkins.
Considering your particular setup, you could both have the amazon linux server run the tests with HTMLUnitDriver, and declare other machines (with a GUI and proper browser) as "nodes" to run your test on other browsers.
Link to a tutorial
Have you read this blog post by David Burns (Automated Tester):
http://www.theautomatedtester.co.uk/tutorials/selenium/selenium_rc_setup.htm
He describes the way to run selenese tests using HTMLSuite.
We are going to use the HTMLSuite commands of the Selenium Remote
Control. This allows you run your Selenese Test Suites as is. The
command should look like java -jar selenium-servre.jar -htmlsuite
. Browser
could be : -*firefox
-*chrome
-*iexplore
-*iehta
-*safari
-*custom /path/to/browser
The path to the test suite and the results file should be a full path.
Here is an example command; java -jar selenium-server.jar -htmlsuite
*iexplore http://www.theautomatedtester.co.uk c:\testsuite\testsuite.html c:\testsuite\results.html
I would point out that htmlunit does not seem to be a supported option so I would expect to use -*custom and provide a path to htmlunit.
This is legacy functionality so there is a chance it doesn't work as expected any more. HTMLSuite expects the tests to be in Selenese (HTML table) format, you mention trying with the PHP binding, I would not expect this to work. If you do want to use some PHP bindings I would suggest using Adam Saunter's fork of the facebook bindings, they are the most up to date and best supported.
https://github.com/Element-34/saunter.php
With Selenium WebDriver you can point to start a HtmlUnit in a already started node
In Java you'll do something like this:
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.HtmlUnit());
To start the node just make sure to set browserName to 'htmlunit'.

Running a Selenium2 IDE test case on the command line

I need to use the Selenium IDE to create tests for projects we are working on, but to then take these tests and run them from the command line.
The situation is that we want our developers to be able to use the IDE to test websites using a central repository of test suites using the Selenium IDE. We also need the same tests (i.e. in the IDE HTML format) to be run by a CI server (Jenkins) on Sauce Labs.
I have found that the export from the IDE isn't great (test cases that worked on the IDE don't work from the command line). I also need to use WebDriver, e.g Selenium2.
This must be possible but I just cannot see how to do it.
Try out Selunit it combines Selenium tests in Selenese HTML format with Continuous Integration. Here is a tutorial how to execute Selenium tests directly from Selenium IDE in Hudson builds and to benefit from its reporting capabilities provided for JUnit, where Selunit transforms Selenium reports to.
Selenium provides a command-line test script runner, but it's well hidden. Check out the -htmlsuite option of selenium-server.jar.
In windows system you have to download selenium-server-standalone-2.32.0.jar and Browser(IE, chrome) driverserver after downlaod you have to open CMD and run command
java -jar selenium-server-standalone-2.0b3.jar -Dwebdriver.ie.driver=.\IEDriverServer32.exe

Setting up Selenium for recording as well as running in different browsers and platforms

I'd like to setup a Selenium server so that clients can record tests locally, recorded tests can be replayed and tested on an Ubuntu server with Firefox + Chrome.
Unfortunately the Selenium site is so confusing and mentions so many different projects (Selenium 1, Selenium 2, Selenium RC, Selenium Grid) that I'm not sure where to start.
How do I go about setting up Selenium Server on an Ubuntu box?
Unfortunately the Selenium site is so
confusing and mentions so many
different projects (Selenium 1,
Selenium 2, Selenium RC, Selenium
Grid) that I'm not sure where to
start.
Selenium has multiple versions
IDE - mainly to record the test and play it back. It is mainly a Firefox Addon. This can be used for very basic testing. You can also export the recorded test to selenium RC. All these mentioned in seleniumhq.org->documentation section: http://docs.seleniumhq.org/docs/
RC - Like any other automation tool, you can write your own code to run the test rather than just recording and playing it back. This has far better capabilities than IDE including support for several languages (Java, Javascript, Ruby, PHP, Python, Perl and C#) and support for almost every browser out there in various platform.
Grid - This helps in running multiple tests in parallel.
To record and run the test in Firefox (NOT CHROME) its very easy. This doesn't require a selenium server running.
record the whole test
save it in a file
Copy the file to Ubuntu machine
Open the same test using IDE in Ubuntu machine and run it again in firefox
If you want to run on chrome, then you need to go to the next level of using selenium RC. And this requires the selenium server running.
How do I go about setting up Selenium
Server on an Ubuntu box
Download selenium-server jar from here. Copy this to any directory in your ubuntu server
Open a terminal and navigate to the folder which has the selenium server jar.
Enter java -jar selenium-server-jarfilename.jar
Selenium server will start on port 4444 by default and keep listening to the tests.
The site is confusing in terms of the versioning and names. Selenium is the name of the entire project which started off as Selenium RC (remote control). Selenium RC is the old version of the API which is also sometimes called Selenium 1. Selenium 2 is the newest version and the latest release was last week being Selenium RC2 (release candidate). This uses a different API to Selenium RC. The new API is known as WebDriver. The new API still allows you to access the older Selenium RC but only for backwards compatibility.
Since you're starting now, there is no reason for you to use the Selenium RC API. You should instead use the advanced user interactions which are part of WebDriver. Setting up WebDriver is pretty easy and there is a decent guide on it here. You should note that the API used there is the older standard (2.0 beta) which uses WebElements. The new API (advanced user interactions) decouples actions from the elements they are performed on a lot more. I would recommend you use the latest versions of the API which is being actively supported rather than older deprecated versions.
Since you want to do this all locally, the second link I gave you should be enough to get you up and running. Assuming you're going to be using the Java bindings it is as simple as:
public class Selenium2Example {
public static void main(String[] args) {
// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new FirefoxDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
Actions builder = new Actions( driver );
builder.sendKeys( driver.findElement( By.name("q") ), "Cheese!" );
Action action = builder.build();
action.perform();
//Close the browser
driver.quit();
}
}
This is the example code edited to use advanced user interactions.
You must have two things to write and execute selenium tests.
1) Selenium Server is also known as Selenium RC (Remote Control). You can go to this link and download Selenium Server.
You can start selenium server with command java -jar ur_selenium_server.jar
2) Client Driver: Using client-driver you can code selenium tests. It consists of combination of selenium commands that perform certain actions on the UI. For e.g. click, select etc.
Selenium supports many different language bindings for client-driver. Download appropriate client-driver for your preferred language from above download page.
You can refer client driver apis and code your tests.
Hope this helps

is Selenium Remote Webdriver Server similar to Hudson CI?

Right now I am using Hudson CI to launch browser in xvnc and run my tests through Webdriver (pre 2.0)
Should I use Selenium remote webdriver instead? is that more efficient than hudson ci?
I want to run my tests on Amazon....are there any selenium remote webdriver server or Selenium Grid plugin that can already integrate with Amazon? Should I pursue Grid or remotedriver server?
My ultimate goal is to be able to launch multiple tests parallel on Selenium on Amazon and be able to quickly scale up and down.
Right now I pay $100/month for server that has hudson CI on it....but I never end up using the whole capacity....
Grid or the Remote Server does not replace a CI tool like Hudson. They will not schedule jobs, parallelize your tests, report results (with history) or send email/IM notifications when builds fail.
So you would still have Hudson (or similar) for all those things, possibly using Grid or the Remote Server to decouple the machine(s) running the browser(s) from the one running the tests.
Selenium Grid will allow you launch multiple tests in parallel. And with the right configuration you can even run the tests of different browsers in parallel.
Selenium grid is still using selenium 1.x remote control drivers. So if you already have your tests written in webdriver code, then you might not be able to use it with current Selenium grid. There is a new version of selenium grid - Grid 2.0 that will be out soon. That will be support webdriver as well.