Why You Should Learn Test Automation With Selenium IDE
Why You Should Learn Test Automation With Selenium IDE
Some may argue that the Selenium IDE is out of date, but this article asserts that there are good reasons to learn Selenium. Learn the fundamentals here.
Join the DZone community and get the full member experience.Join For Free
Discover how you can reduce your Kubernetes installation from 22 steps to 1.
A.N.: Actually, we'll be talking about functional test automation for web applications. Here, I use the term “test automation” to keep it concise.
In my previous article, I briefly mentioned Selenium IDE, and to be honest, I did not give it the credit and appreciation it deserved. In fact, Selenium IDE is a great tool for introducing testers to automated testing.
For those who are not familiar with Selenium IDE, it is a Firefox extension built and donated to the Selenium project by Shinya Kasatani. Selenium IDE provides an easy-to-use interface for creating automated tests by capturing user actions as they are performed and exporting them as reusable scripts in many programming languages and frameworks.
Selenium IDE main GUI.
Some people might realize that it only works with Firefox (which is no longer as popular as it used to be), or worse, it only works with Firefox before version 55. There is a compatible replacement from the Katalon Studio team — Katalon Recorder for Firefox and Chrome — which aims at supporting all features of Selenium IDE on modern browsers. But that is another story.
Now, some people would argue that you should never use Selenium IDE, especially since there are many valid reasons for not using it in a large automated testing project, and I agree. However, just like programmers started their journey with plain text editors and command lines before getting their lives depend on advanced IDE like Eclipse or IntelliJ IDEA, we testers need some bite-size lessons on test automation before really getting into it.
And Selenium IDE did this job really well — that’s one of the reasons why lots of people are still using it every day.
A picture is worth a thousand words. Image courtesy: Brian Anderson.
Why should a tester learn test automation with Selenium IDE, instead of something trendy, sophisticated, and modern? Because this tool will help you:
Understand test automation, and see its benefits.
Really understand what test automation is, what it is not, and avoid potential blunders.
Work through common concepts (assertion, locators, data-driven testing, etc.).
See the same tests in popular programming languages and frameworks (because sometimes taste matters — you need to know what is your favorite one).
And it does that without getting you involved in irrelevant things like complicated GUI, boring documents, and proprietary stuff that is only helpful for a single tool. Never look for “the best test automation tool” without knowing what you need, and what it can offer—do not get yourself burned only after investing too much time in a solution.
Here is a simple example to show you how Selenium IDE works. At first, you record your actions on a website and adding some assertion (checking).
Record & Play a test with Selenium IDE.
Then you play (execute) the test. You can see that basically, test automation involves making machines doing predefined actions and checking. Thanks to that you will have more time for doing exploratory testing (Point #1). However, do not expect it to magically catch more bugs for you unless the developers messed up some stable areas of your software (Point #2).
This test can also be exported to scripts in various programming languages and frameworks for advanced adjustments or learning purposes. Among them are Java, Groovy (used in Katalon Studio — my favorite), C#, Ruby, Robot Framework (also my favorite).
A script exported from Selenium IDE.
As you see, Selenium IDE — albeit the simple look — provides a comprehensive set of commands and features for different purposes, which helps you practice and understand fundamental concepts of test automation.
Trigger action: Click, Double Click, Type, Submit, etc.
Locate elements: both CSS and XPath are supported.
Verify & Assert: for checking if the AUT (application under test) is working correctly (for example, VerifyText, VerifyElementPresent, VerifyTitle, etc. — therefore, some people state that automated testing is really automated checking). Advanced pattern matching methods like Glob and Regex are supported.
Store & Echo: for calculating dynamic values, working with variables and logging.
Debug: for fixing the test scripts (See? It is not a dump tool).
Data-driven testing: for running a test multiple times with different inputs. This is an important factor to take into account if you want to design your own framework.
And so on.
They are fundamental functions that any good test automation tool must offer. You will need this checklist for tools evaluation or framework design.
Selenium IDE is not designed for executing tests in an unattended manner. If you are new to test automation, I suggest you run your tests several times to feel this pain “physically”. Easy execution and reporting is a crucial problem that many test automation tools have forgotten to solve it thoroughly.
I will elaborate on each of above points as well as the execution problem in next articles.
Published at DZone with permission of Alice Ald . See the original article here.
Opinions expressed by DZone contributors are their own.