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:
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 solution that will help anyone who is not comfortable with writing and then supporting code, but still wants to test web app 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 non-programatic way in Perfecto Scriptless. To start with Perfecto Scriptless for Web, navigate to your Perfecto Cloud and click "Build Web Test."
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
Solution Engineer, Perfecto by Perforce
Nato has been with Perfecto for more than five years. During his time, he has worked with the largest German banks by helping them achieve top ratings for their applications. Nato achieved this by implementing Perfecto and enforcing best practices in line with the industry standard methodologies.
The experience that Nato has gained from his various roles contributes to his daily success and helps him better understand Perforce customers' needs, risks, and level of urgency for every project. Nato has years of experience with QA Automation, is a Certified Microsoft Expert, over 13 years of IT experience, and has authored numerous articles and blogs.