Acceptance and Regression Testing With Selenium: Part II – Selenium Specifics

Why Selenium is special? There are just two key factors: it is easy to use, it may be adapted to your goals without much problems and effort. Simplicity and extensibility are key success factors in many applications and Selenium is not the exception.
Why it is simple? What simplicity means for automated tests framework? As a tester I want easy tests creation, easy to understand format to tests maintainability and in the best case no programming at all. In ideal case I want to generate all automated tests right from my test cases. It means if I write test case it can be generated to something executable in minutes with single key push. While Selenium is not that powerful, it is closest tester-dream-tool I know about.

Recorder

Many tools have recorders, Selenium is not an exception. You may start web browser, run Selenium IDE and record any test you want. Funny thing is that we almost not use recorder to create tests for TargetProcess. Why? We find it more fast and easy to create test manually. Do you believe in that? Selenium tests are so easy to create that you even don’t need The Recorder!

Format

Selenium test is just an old HTML file with various directives. Here is an example of simplest test

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>add_user</title>
</head>
<body>
<table>
<tr>
 <td>open</td>
 <td>http://localhost/tp2/Default.aspx </td>
 <td></td>
</tr> 
<tr>
 <td>verifyTextPresent</td>
 <td>ToDo</td>
 <td></td>
</tr>
</table>
</body>
</html>

Each test is selenium represented by set of actions or steps. And each step is a row in table. The example above has two steps and two rows (<tr> tag). First step opens url and the second step verifies that text ToDo presents on the page.

Learning Curve

It is small. Within an hour you will be able to create simple test and run it. Within a day you will figure out some best practices and will be able to create quite complex automated tests for your application. Within two days you will be able to create some extensions that optimize your work and make tests more robust. It is one of the simplest testing tools I had work with for sure. How much time you will need to learn WinRunner?

Here is the list of things you should know to create selenium tests:

  • Dozen of commands like open, click, verifyTextPresent
  • XPath basics (actually you need half an hour to learn them)
  • DOM basics
  • (optional) JavaScript, for extensions creation

Extensibility

Extensions mechanism as you expect is simple as well (I am tired of the word “simple”, but such as Selenium!). All you need to do is add javascript function into user-extensions.js. There is one complexity however – you have to know JavaScript and DOM.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s