Toolroom Tech Blog

Devlopers Digest

Selenium: Automated UI Tests For The Web

Silencium, Silencium. Selenium.In short terms Selenium is a suite of open source tools to automate U

Silencium, Silencium. Selenium.

In short terms Selenium is a suite of open source tools to automate UI Tests for web applications. And by the way ... you can even automative annoying administrative tasks with it :)

Let's outline what Selenium means

Browser Automation

Selenium wraps the Browser and uses its native Automation Support. It provides full access to the dom and of course JavaScript.

Supports single-page applications

Due to its JS and asynchronous support, Selenium is great for testing SPAs.

Large browser support

Selenium supports a wide range of Browsers, even for mobiles.

Supports multiple programming languages
Write (or record) coded UI Tests with the programming language of your choice: Java, C#, Python, Ruby, Perl, PHP

Well documented API

Selenium has a considerable documentation available on their Website. Including samples in different languages.

Open Source

Wow! You can get Selenium for free!

The Selenium toolset


Selenium 1 (aka. Selenium Remote Control / RC)


Selenium 1 was the main Selenium project for a long time, it still has support but not active development. Not all functionality of Selenium 1 is availabable on Selenium 2 yet, so this may be your project in some special cases.

Selenium 2 (aka. Web Driver)


Web Driver addresses the limitiations that arose with Selenium 1. With the WebDriver API, Selenium provides a more cohesive and object oriented approach than its predecessor. It furthermore has a much better support for single page applications, that became popular at least with Angular, Backbone and Ember.
While using Selenium Web Driver you are usually not required to run the Selenium Server, since Web Driver will directly invoke the browser. But in certain cases, i.e. if you're using Selenium-Grid or want to connect to remote machines, you will need it.

While Selnium 1 injected JavaScript into the browser and used its JavaScript to drive the test, Selenium 2 directly utilizes the browsers native automation support.

Selenium IDE


Selenium IDE is a Firefox plugin that provides prototyping for test cases. You can record your tests and export them into one of the many supported programming languages. But remember, Selenium IDE is not intended for serious, robust test automation!

Selenium Grid


Selenium Grid allows to run your tests in parallel on different remote machines. This has two advantages:
  1. significantly boost the performance of your large or just slow test suites
  2. run your tests within multiple environments

Selenium WebDriver and .Net


Using Selenium with your project is as simple as possible.

1. Create or just reuse a directory where you can provide the Selenium Driver for your Browser. Then add this directory to the PATH variable. You can also store the files directly within your solution, but there may be issues depending on the solution. I prefer the PATH way.
2. Download the latest Web Driver for the desired browser
3. Create a unit test project with Visual Studio
4. Download the latest selenium-dotnet.zip from http://selenium-release.storage.googleapis.com/index.html
5. Extract the selenium-dotnet files and reference them within your VS project
6. Write your test and ... run it.

 

If you want to see an example, just ask!

Loading