Automated testing with Selenium IDE

Automated testing is an extremely useful bug-killing tool for the modern Web developer and a lot of vulnerability in fact are based on bugs.
With Selenium IDE, a free Firefox extension, you can easily record your clicks and inputs in the browser, set tests and replay the records. If a test failed you get a feedback.

I’ll show you an example, to make the power of Selenium clearer.

This example code echoes a form value.

<input type=”text” name=”name” value=”” />
<input type=”submit” value=”send” />

<? echo $_GET[‘name’]; ?>

Start selenium and make sure the record lamp (red) is on. All steps will now record as long as the lamp is on.

selenium 1

Send a string “bla” over the form

selenium 2

Mark the output “bla” and choose in the right mouse context “verifyTextPresents bla”.
This is a testcase that “bla” is on the site displayed.

selenium 3

Go back to the selenium window and stop the recording (click on the red lamp).
Now it’s possible to run a playback of the recording, in 3 tempos (Run, Walk, Step), by pressing the green play button.

selenium 4

Ok time for a bug, change the variable name in the php line from “name” to “foo”

<input type=”text” name=”name” value=”” />
<input type=”submit” value=”send” />

<? echo $_GET[‘foo‘]; ?>

now we run a test in selenium and get a red marked error, because selenium doesn’t found the string “bla”.

selenium 5

This is only a bit of the power from Selenium. You can also debug with breakpoints, save tests in a lot of formats, edit the tests by hand, …

example video:

3 comments so far

  1. Mamzee on

    Real helpful man! I needed to test a page I had written in, and having heard of Selenium I downloaded it, but didn’t know how to work with it. Until I came around your blog…

  2. Johny on

    It s nice for frontend Testing where you watch but for real automated one it seems to be not usable yet

  3. Todor on

    The extension is very useful. Use it to automate some your tests and you will save a lot of your time.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: