Save Time Testing Submissions with Selenium IDE

Marketing departments love forms. “Contact us!” “Sign up for our newsletter!” “Create an online account!” Forms submissions are the life force of lead generation: without them, sales opportunities drop significantly. Therefore, in terms of best quality assurance practices, it’s critical that a company’s online forms are tested periodically, as well as during each new build or project release, to ensure that the submissions process continues to be maintained and working efficiently.

But what if a company’s website offers 25-30 different form options – unique engagement forms on every major landing page, for example. Manually testing these forms (which includes any error messages that should generate during completion if required fields are left blank or filled out incorrectly), sometimes multiple times each due to differing dropdown choices or variable-dependent question options, could potentially take hours. Not to mention checking the backend processing – admin emails being received on the company-side of things, “thank you for your interest” emails being received on the potential customer-side of things, and so on. And sometimes forms take two steps or even three-to-four steps until completion! You can see how testing forms gets complicated and lengthy fast.

So how can we make testing forms submissions more efficient?

(Re-)Introducing Selenium IDE

Luckily, we, as quality analysts, don’t have to do anything: someone else has already done something for us! This “someone” is made up of the clever and talented contributors of Selenium, which is a suite of tools that automate web browsers across multiple platforms.

Selenium IDE is one of the tools in the suite: a multi-use “integrated development environment for Selenium scripts.” In English: a tool that allows you to record, edit, and debug tests, i.e. automated testing. Whether you are a coding expert and wish to write scripts by hand in a pre-made environment using various programming languages, or, like me, you’re simply looking for a way to record a test somewhere and use it again in the future, Selenium IDE is an incredible asset for any quality analyst.

Selenium IDE works as a Firefox extension, so you can only run it in that browser. The good news, though, is that you can run it in both Windows and Mac. For forms submissions, the fact that you can only test in Firefox shouldn’t be a problem, since testing forms isn’t browser-specific (rendering of forms might be, but the actual submissions process is not). It’s very easy to download the extension; you can do so on Selenium’s website (linked to above).

Like I said before, you don’t have to be a coding expert to use this tool! In fact, Selenium IDE’s best feature is its ability to record your mouse clicks, opening/closing of documents, content entry, dropdown choices, etc. – essentially, all of your major actions in the browser (things we do everyday while we browse Facebook or Google without thinking about it!). Though you can’t run conditional actions using Selenium IDE, you can replace needing to by running multiple tests in a row, which is great for those websites we were talking about before that have 30+ forms, if not more!

For more on the history of Selenium (which has actually been around since 2004!), check out this page.

How to Use Selenium IDE for Forms Testing

Alright, so let’s use this bad boy! What you will need: Firefox, access to all of the forms you are required to test, and a little patience.

1. Download the Selenium IDE Extension.

The first thing you’re going to want to do is download the Firefox extension straight from Selenium’s website (see link above). Once you do that, you should have a little easy-access button at the top of your browser (you may need to restart the browser after the download to see it appear):
Screenshot_7

When you click on the little button, a window will pop up that looks like this:

Screenshot_2

2. Record your test cases

Now you’re ready to record some test cases!

a. Clear the cache

The first thing you should do (as with any browser-related testing) is clear the cache. Go into your Firefox browser settings and make sure to clear out all history, cookies, cache, etc.

b. Open the forms

If you haven’t already, now you should open every URL that has a form on it for your company’s or client’s website – this includes internal site pages with forms, all unique, independent landing pages, etc.

Yes, I know, it might be a lot – but if you do this right, you’re only going to have to do it once! Woohoo!

c. Record the first test case

Go to the first form you want to test. When you’re ready, flip back to the Selenium window. In the upper right-hand corner of the Selenium window there should be a red “record” button. Click this!

You are now officially recording! Click back to the first form you want to fill out, and fill it out, one step at a time. Don’t worry about speed – it’s more important for the information to be filled out correctly so the form will submit, versus going as fast as you can. Selenium will speed the process up for you once the test case has been recorded.

d. Recording multiple test cases (i.e. using test suites)

One of the best things about Selenium IDE is that it automatically batches test case into larger groups called test suites. This is great if you end up getting interrupted during your recording and need to pause, or, if you’re like me, and prefer to save every single form as a separate test case (for organizational purposes). So, you can submit one form, then flip back to the Selenium window and click the same red button again to stop the recording, and the test case will be saved in the suite. To start recording again, just go to File > New Test Case, and begin a new recording.

e. Saving test cases and test suites

When you’re done recording all of your test cases (either separately or together), they will appear on the left hand side of the Selenium window, in a big list.
Screenshot_4

The cases will be untitled at first, so you need to name them by saving them (go to File > Save Test Case). I recommend saving them to your desktop, and then making a desktop folder to keep them in for later use. Since I like to do each of my forms as single test cases for organizational purposes, I always end up with as many test cases as there were forms to test, each named after the forms I’ve tested (so, a test case might be titled “[Company Name] Contact Us Form”, etc.). These cases are all part of the overall test suite. When I’m done, I’ll also save the entire test suite itself (usually also on the desktop) for safe keeping (named “[Company Name] Forms Suite”, for example). You can do this by going to File > Save Test Suite. It’s important to note that you can only save a full test suite after naming and saving the individual test cases – it’s a little bit of a pain, but worth it in the end!

That’s it! It’s that simple!

3. Run your test cases
Screenshot_5

Now that you’ve spent the time recording all of your forms submissions into test cases, you can automate the process! Pretty awesome, right?

a. Open previously saved test cases

Let’s say it’s a month later and your company is running a build release, so all forms need to be tested as part of a regression test plan. Now you don’t have to spend hours doing this manually, you just need to open that test suite you recorded in the past and run it in Selenium IDE.

Go to File > Open and open the saved test case you want to start with in the Selenium window. All of its data should appear! If you have multiple forms to test, with multiple test cases each, I recommend opening that entire test suite you also saved – which will automatically open every test case for you!

b. Play test cases

When you’re ready to test, simply hit the green play button and the test cases will run!

You can control the speed at which the cases run with the speed control slider. If your build is time sensitive, run those babies as fast as possible! If you have some time to spare, though, it can be useful to watch the cases run a little more slowly – sometimes you can catch errors that way, or notice browser interface/rendering/user experience issues that you might not have noticed otherwise while actually filling out the forms manually.
Screenshot_6

When the test suite has finished running, and all the cases are done, all you need to do then is check any “thank you” pages that were generated by the forms submissions (on the website(s)), as well as any admin or customer-related emails that should have been generated.

c. No system is perfect

It’s important to note that Selenium IDE, like with anything, isn’t 100% perfect. Errors CAN happen. Sometimes Selenium struggles to locate reference points, for example. It can also get confused if you forget to clear the cache (always clear the cache!!). If Selenium can’t locate certain elements that have been recorded, you will need to open up the code and explore it – see if you can find something you can use to identify where errors might be happening (such as div id, image source, frame name, class, etc). If you can’t do this on your own, get someone from your development or tech team to help out! Luckily, if an error has occurred in Selenium, you will definitely know – the test case will highlight red in the Selenium IDE interface, and the number of failures will be recorded in the window.

Going Beyond Forms Testing

There’s more you can do with Selenium, and the other tools in the overall Selenium suite. Check out their full website for even more info: http://docs.seleniumhq.org/

There’s also more QA testing you can do beyond forms testing.  Learn about other types of QA testing, what QA entails and some commonly used QA terms in: “Intro to QA Lingo.”

TAGS:
« Prev Article
Next Article »