How to Do Selenium Regression Testing With Perfecto
February 28, 2022

How to Do Selenium Regression Testing With Perfecto

Scriptless Testing

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.

Why Selenium for Regression Testing

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 >>

How to Start With Selenium Regression Testing

To maximize the impact of your Selenium regression testing (as well as software regression testing with other frameworks), we recommend the following best practices:

1. Clarify Requirements

Focus on the product and clarify what’s important for you, the product team, your customers, and other stakeholders.

Ask yourself:

  • Should I test only one application or more?
  • When am I going to run the regression tests - at the end of each sprint or only after major changes?
  • How is a major change defined?
  • When do I need to reach full regression coverage?

2. Review Potential Use Cases

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.

3. Create a Baseline

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. 

4. Choose Your Tech Stack

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: 

  • Fingerprint / Face ID. 
  • Simulation of network conditions (loss of connectivity, bad network coverage).
  • Simulation of location.
  • Image injection, such as barcodes or QR code scanning.
  • Audio injection.
  • SIM cards.
  • Latest device OS availability since day 1 release. 
  • Full control of system settings (i.e. Offline mode, Low battery mode).

5. Organize Processes

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.

6. Create Tests

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.

How to Run Selenium Regression Tests 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.

Option 1: Coded Selenium Regression Testing

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

		reportiumClient.stepStart("Verify title");
		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.

Test steps:

  • Navigate to
  • Click on the first tab (PLATFORM)
  • Select the first menu item (Testing Cloud)
  • Make sure all submenu items are there (Mobile, Web, Scriptless, Platform Overview)

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.


Perfecto Object Spy for mobile locator detection.
Perfecto Object Spy for mobile locator detection.


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");
		driver.findElementByXPath("//*[text()=\"Testing Cloud\"]").click();
		driver.findElementByXPath("//*[@id=\"platform-col-2\"]//*[text()=\"Platform Overview\"]");

For the desktop web test you can use DevTools:

Devtools for code extraction.
You can use Devtools for code extraction.


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: 


Option 2: Low-Code Testing With Quantum 

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:


Example of Selenium regression testing with Quantum.
Example of Selenium regression testing with Quantum.


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.

Option 3: Scriptless Selenium Regression Testing

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.”


Perfecto cloud


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:

  • The step will appear on the left side pane.
  • Move on to the next buttons you want to test.
  • When you are done with creating your test, you can view all your tests in a list format.

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.


Test execution in the Perfecto Cloud


You can even get notified via email or Slack when the test finishes running:


Setting up an alert for your Selenium regression test reporting


After the test is executed, you can check Perfecto's reporting and monitor your test results.

Bottom Line

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


Related Resources