View all web browser and mobile devices available in our cloud-based test lab.
Automating tests enables achieving speed and efficiency throughout the development process. With automated Selenium regression testing, teams can find bugs and issues in their web tests on time and with minimal tester overhead.
In this blog post, we will focus on running automated Selenium regression tests and explain how to run code-based and scriptless regression tests.
Selenium is an open-source set of tools for automated web testing. Today, it is the leading tool for web testing on both desktop and mobile devices. By running test Selenium scripts against web browsers like Chrome, Firefox, and Safari, testers can ensure their web app doesn’t break.
Selenium can be used for a wide variety of tests, like UI testing, sanity testing, and regression testing. Running Selenium for regression testing helps developers find defects in their web apps before they impact customers. Strategically, such tests help developers modify code and introduce new features.
Automating Selenium regression testing lets testers focus on fixing issues or on more complicated types of tests. In addition, automation ensures tests are run methodically and efficiently and are not subject to human error.
Related Reading: Automated Regression Testing: A Comprehensive Guide >>
To maximize the impact of your Selenium regression testing (as well as software regression testing with other frameworks), we recommend the following best practices:
Focus on the product and clarify what’s important for you, the product team, your customers, and other stakeholders.
Use cases will help you understand exactly what you are facing. Start with a logical description of the tests you would like to cover. Don’t forget difficult scenarios so you can be fully prepared.
A proper baseline we can build on top of will enable us to understand where we are and how we’re progressing to where we need to be.
Choosing your tech stack includes the scripting language, the testing platform, and the scaling tools. Take into consideration the expected results, inbound and outbound data, and what needs to be covered.
Besides the usual tapping and scrolling you also need to prepare the following for mobile web testing:
The creation of processes is where we can start talking about automation and scaling with CI/CD tools. Expanding too quickly might lead to wasting valuable resources.
Achieve a critical mass of tests and add them to the automation pattern. All these tests need to be compliant with the general course of action and they should be atomic. This means they should be able to run autonomously without dependencies on other tests.
Now you’re ready to run the tests. Let’s see how, with Perfecto.
There are three ways to perform Selenium regression testing with Perfecto: code-based, low-code with our open-source Quantum framework, and scriptless. Let’s look at each one.
For our code-based option, we will create a Java-based Selenium regression test, with TestNG and Maven. Please note this is an example project and there are many ways to create coded tests.
In your project, you will see three different device options: Android, iOS, and desktop.
You will notice that the code is identical. WithSelenium and Perfecto, you can reuse the same code for different device types. This makes them a fast and easy solution for responsive website testing.
Here is part of the code snippet for this first type of scenario:
reportiumClient.testStart("Perfecto desktop web test", new TestContext("tag2", "tag3")); //Starts the reportium test
reportiumClient.stepStart("browser navigate to perfecto"); //Starts a reportium step
String aTitle = driver.getTitle();
PerfectoLabUtils.assertTitle(aTitle, reportiumClient); //compare the actual title with the expected title
Now, I will create a few scenarios that cover some of my own use cases. To keep the tests atomic, I will keep the navigation to the site for each step.
To create more tests, repeat these steps, but click on the second and third menu items when you reach step 3.
For help with the locators for the mobile test, you can use Perfecto's Object Spy to select the element you need after opening a device in your cloud and navigating to the desired page.
Below you will see a snippet of the code for the testing cloud use case for mobile devices:
reportiumClient.stepStart("Verify Testing Cloud Submenu Items");
For the desktop web test you can use DevTools:
Below is a snippet of the code for the testing cloud use case for web browsers. As you can see, test creation is easy and fun to play with. This makes testing user-friendly and easier to run:
reportiumClient.stepStart("Verify Testing Cloud Submenu Items");
You can also organize the tests with the help of TestNG by navigating to the following XML: “PerfectoJavaSample/testng_perfecto_selenium.xml.”
This video shows how to run coded Selenium regression tests with Perfecto in more detail:
Quantum is Perfecto’s open-source BDD testing framework. Quantum can be used by both coders and people with low to no coding skills. It provides the ability to create a script by using simple sentences following your testing path.
Quantum is a great fit for teams who are just starting with regression testing or those who already have some scripts in their pipeline. Here is an example of the same test that we discussed in the previous section, written as a BDD test in plain English:
You can see how easy and straightforward it is to simply build up the whole test by going through the logical steps you have in your mind. Quantum also provides a large number of pre-written steps for testers.
If you want to add your own steps you can easily do that as well.
Perfecto Scriptless is a no-code solution that will help anyone who is not comfortable with supporting and writing code, but still wants to test features. Test setup is easy and can be done by a few mouse clicks. All tests are based on Selenium code, but are created in a completely visual way through Perfecto Scriptless.
To start with Perfecto Scriptless, navigate to your Perfecto Cloud and click “Build Web Test.”
On The Welcome page, name your project, test, and URL. Then click “Start Building Test.”
In a matter of seconds, Perfecto will spin a virtual machine (VM) for your test, which will be available to you for as long as you need it. After the VM creation is complete, you can start creating your test with ease and efficiency.
Just like before, we are going to check if the submenu items are visible for Testing Cloud, Testing Features, and Automation Frameworks.
Click on an element and select an action to create a step:
To execute, organize all tests into a job run. You can choose whether to run the tests on a schedule or at a specific time interval.
You can even get notified via email or Slack when the test finishes running:
After the test is executed, you can check Perfecto's reporting and monitor your test results.
Selenium regression testing is both simple and scalable with Perfecto, and accessible to everyone on your testing team.
Try out Perfecto’s regression testing capabilities with a free trial, or watch a demo of our regression testing (and other testing) capabilities.
Try Perfecto Watch a Demo
Sales Engineer, Perforce
As a sales engineer at Perforce, Nato operates in a challenging, fast-moving, high-intensity role. The experience that Nato has gained from his various roles contributes to his success daily and helps him better understand Perforce's needs, risk, and urgency for every project.
Nato has an M.Sc in both Industrial Management and Computer Systems and Technologies. He holds certifications in Microsoft and IT Service Management.