Testing is a vital part of the software development lifecycle for any team, from small to large. Testing early and often ensures that bugs are found and fixed promptly, preventing them from snowballing into costly issues down the line. An important part of this process is regression testing or making sure that present functionality isn’t broken by the introduction of new features. Because of the iterative nature of software development, regression test suites tend to grow with every update, and it can quickly become tedious and time-consuming to manually perform all of the test cases.
This is where automation testing comes to the rescue! By using automation software, such as Selenium, regression testing becomes as simple as pressing a button and letting the computer do all the work. This saves time and frees up resources to focus on other issues. However, making the leap to automation testing can be a daunting task for someone who only has experience with manual QA methods. If you find yourself in that boat, then you’ve come to the right place! In this article, we will learn how to use the Selenium IDE plugin for Google Chrome to create and execute our first automated test case!
Before we get started, download the Selenium IDE plugin for Chrome here:
Creating Your First Test Case
Once you have downloaded Selenium IDE for Chrome, before we can create a test case, we will have to create a new project. Start by launching Chrome browser and clicking on the Selenium icon in the top-right corner. Once Selenium IDE has loaded, you should see a window that looks like this:
Click on ‘Record a new test in a new project’. Name the project whatever you like – I will be naming mine ‘Selenium 101’. After choosing a name, you will be prompted to enter a base URL for the project. For this exercise, we will be using the following URL:
This page was created as a resource to help people learn automation testing, so it is perfect for our purposes. Enter the URL and click ‘Start Recording’.
A new instance of Chrome browser should be launched with the base URL entered. You should see the following banner somewhere on the page:
For our first test case, let’s automate the completion and submission of a basic form. While Selenium IDE is recording, click on the link labeled ‘Fill out forms’. On this page, you will see two forms side-by-side. Fill out the leftmost form with your name and a message, and click ‘Submit’. You will notice that Selenium IDE is recording what you do and translating it into steps for it to recreate later. It should look something like this:
Click on the red square icon in the top-right corner to stop recording. At this point you will be prompted to name the test case – I chose to call it ‘Submit Form’.
Now that our first test case is made, let’s see it in action! Click on the ‘Run current test’ icon at the top of Selenium IDE (or press ctrl+r). You should see a new Chrome browser instance open and automatically navigate to the base URL, proceed to the ‘Submit Form’ page, enter the values that you chose, and then submit the form. Once it’s completed, you will see a message in the log displayed at the bottom of Selenium IDE indicating that the test was completed successfully (unless it failed for some reason).
It’s that simple! Now, instead of having to fill out forms manually over and over again, you can automate the process and let the computer do the work for you!
Now that you’ve gotten your first test case out of the way, I encourage you to explore the website some more and try to create some more automated test cases. The page has several different links that have a variety of web elements for you to play with. As you experiment, take note of how what you do is translated into steps in Selenium IDE.
This is just the tip of the automation iceberg. While the record-and-play function of Selenium IDE is great for simple tests like the one covered here, there are far more possibilities with creating your own custom test scripts. While that is outside the scope of this article, you can start familiarizing yourself with the scripts by exporting your test cases from Selenium IDE into test scripts. You can choose from a few different programming languages, including Java and Python. This is a great way to start automating some simple test cases while also preparing yourself for bigger and better things with custom test scripts!