DEV Community

Cover image for How To Simplify Your Automated Testing With AI: A Beginner's Guide
Antonello Zanini for Writech

Posted on • Originally published at writech.run

How To Simplify Your Automated Testing With AI: A Beginner's Guide

Imagine being part of a software testing team whose goal is to ensure the quality of a web application. The team spends countless hours crafting end-to-end tests with technologies such as Selenium. As the project grows, the number of test scripts required increases exponentially, leading to an overwhelming amount of maintenance. You all begin to struggle to keep up with the increasing complexity of the workload. Not only does this put pressure on the testing team, but it also hinders the efficiency of the entire project.

That is not a fictional story, but a real-world situation that thousands of IT companies have faced at some point or another. They all want to streamline the testing process. Yet, it is not easy with traditional tools. This is where automated testing based on AI comes into play!

In this article, you will learn how artificial intelligence is revolutionizing testing. In detail, you will see how an AI-based tool like testRigor enables you to achieve a faster, more efficient, and more reliable software testing process — while also improving team dynamics and communication.

Let's dive in and discover the world of simplified automated testing with artificial intelligence!

Why AI Is the Future of Automation Testing

Traditional automated testing methods are starting to crumble under the weight of the increasing complexity of modern applications. Web and mobile apps receive updates constantly, making it difficult for the testing team to create and update test scripts accordingly.

After all, building and maintaining test scripts is a time-consuming and resource-intensive task. Not all companies can afford to allocate many of their engineers to testing. Because of that, companies may decide to neglect or skip it altogether, producing poor-quality software.

Web and mobile applications need testing approaches that can adapt to their ever-evolving nature. Traditional testing tools may no longer be the best option, especially when it comes to efficiency and effectiveness. Here is why the QA industry is evolving, moving toward AI-based testing, self-learning test bots, and even AI-driven bug detectors. These trends have in common that they are connected to artificial intelligence, which is changing the rules of the QA game.

By harnessing the power of machine learning and data analytics, AI is changing testing forever. AI-based testing tools now allow you to write tests in natural language, as you would do in documentation to explain a use case. This means functional automated tests that anyone can write, understand, and maintain.

What Is testRigor?

testRigor is a full-featured AI-based testing system that enables anyone, including manual testers to build complex end-to-end test automation without the need for coding skills.

To understand the who, what, when, where, and why behind this tool, let's take a step back to the early days of this technology.

Founded in 2015 by Enzo and Artem, testRigor emerged from their frustration with the difficult and unreliable nature of traditional testing technologies. These two forward-thinking engineers recognized the issues within software testing and seized the opportunity to revolutionize the process.

They were motivated by a challenging idea: find a way to make automated tests dramatically more stable. The plan also included simplifying the test writing as much as technically possible to help companies focus their testing efforts on the unique features of their products. Their belief was that common tests, those that most projects require, should be handled automatically.

Fast-forward to the present, testRigor has evolved into a powerhouse in the software testing arena. It now helps over 10,000 customers, including industry giants such as Netflix, BusinessWire, and Splunk. To simplify the testing process even further, the company has also begun to focus on the development of generative AI.

"We spent so much time on maintenance when using Selenium, and we spend nearly 0 time with maintenance using testRigor" — Keith Powe, VP of Engineering at IDT Corporation

The growth of testRigor has been nothing short of remarkable, a testament to its uncomplicated yet effective approach to testing. It stands as a vivid example of how a sound idea, fueled by hard work and the courage to innovate, can lead to profound changes in the tech landscape.

Features and Capabilities

The top features offered by the tool are:

  • Plain English-based testing: Anyone, even non-technical users, can define tests in natural language. Creating a test boils down to describing a task in plain English. To avoid writing the same things over and over again, you can group several steps into rules and call them in your tests.

  • Cross-browser and cross-platform in one test: You can build complete end-to-end flows across web, native and hybrid mobile, and native desktop applications — all in one test. There are also direct integrations with tools such as LambdaTest and Browserstack, opening access to thousands of device-browser combinations.

  • Minimal test maintenance: Tests do not rely on implementation details, which means that you do not need to use HTML element locators. It also means that each test case is drastically more stable compared to other test automation tools.

  • Robust ecosystem: testRigor encompasses a vast range of testing types that are infrequently supported by other tools. These include API testing, 2FA, validation of uploaded files, database access, the ability to modify device geolocation, SMS, phone calls, and more. It also integrates seamlessly with numerous issue-tracking systems and the majority of CI/CD tools.

To better understand the impact of these features on automated testing, let's take a look at an example. Consider the following Python test script using Selenium:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys

# initialize a controllable Chrome instance
driver_path = "<path_to_driver>" # replace it with the path to your ChromeDriver executable
driver = webdriver.Chrome(driver_path)
driver.maximize_window()

# visit the desired page
driver.get("https://www.browserstack.com/users/sign_in")

# select the login form HTML elements
username_input = driver.find_element(By.ID, "user_email_login")
password_input = driver.find_element(By.ID, "user_password")
login_button = driver.find_element(By.NAME, "commit")

# fill out the form and submit it
username_input.send_keys("abc@gmail.com") # replace it with your BrowserStack email
password_input.send_keys("your_password") # replace it with your BrowserStack password
login_button.click()

# select the HTML element showing the welcome message
# and make sure it contains the expected message
welcome_element = driver.find_element(By.XPATH, '//*[@id="wpbody-content"]/div[2]/header[2]/div/nav/ul/li[5]/a/span')
assert welcome_element.text == "Welcome Peter"

driver.quit()
Enter fullscreen mode Exit fullscreen mode

This script automates a web login process. It instructs a ChromeDriver instance to navigate to the specified URL, fill out the login form, and submit it. Then, it verifies that the welcome message displayed on the page contains the expected text.

In testRigor, you can achieve the same result with just two simple instructions in plain English:

login  
check if page contains "Welcome Peter"  

Enter fullscreen mode Exit fullscreen mode

This will save you so much time!

Benefits of AI-based Automation Testing

You now know what testRigor is and what it has to offer. All that remains is to explore the advantages coming from adopting an artificial intelligence-based testing tool.

Virtually No Maintenance Required

Tests written with Selenium, Playwright, Appium, and similar solutions are strongly coupled with the underlying layout structure of the application. In testRigor, that is not the case as UI changes do not affect already defined test cases. This eliminates the need for constant maintenance typical of traditional testing technologies. In particular, testRigor users have reported up to a 99.5 percent reduction in test maintenance efforts compared to traditional methods.

High Reliability

It offers higher reliability than traditional testing technologies because it is resilient to updates in the underlying technology applications rely on. In addition, even when the host server crashes, testRigor is smart enough to detect the problem without throwing an error. This ensures a more stable and robust test execution, bringing false positives to almost zero.

Maximized Efficiency

Being a codeless system, anyone can use it to implement automation testing without writing any code. Even non-engineers can build tests, bridging the gap between engineers writing automated tests and manual testers. This fosters collaboration across teams, reducing QA overhead and significantly speeding up the testing process. In detail, testRigor's clients have noticed that manual testers can write tests up to 15 times faster than QA engineers are able to with traditional testing tools. This makes it possible to achieve more than 90% test coverage within the first year.

No Testing Infrastructure Required

As a SaaS cloud platform, it saves you time in putting up a testing infrastructure. This reduces configuration and maintenance costs, allowing teams to focus more on testing and other QA activities. It also has parallel testing capabilities, allowing multiple tests to run simultaneously without you having to set up a multi-thread system.

Building Automated Tests in Plain English with testRigor

Follow this step-by-step tutorial and learn how to use testRigor in a real-world example.

The target page to test will be the Safeway "Create account" section. Here is what it looks like:

The login form

The goal is to fill out the form with some data in the wrong format to verify that the validation message contains the expected text. Let's get started!

1. Set Up testRigor

First, you need a testRigor account. If you have not done it yet, you can subscribe by filling out the sign-up form below to get access to a 14-day free trial:

Signing up for testRigor

Enter the required data and then press "Register Now."

Verify your email, wait for the verification process to end, and you should now be seeing the following testRigor Test Suites dashboard:

"New Test Suite" form

Great! You are ready to write your first test!

2. Create a Test Suit

Fill out the "New Test Suite" form on the right. You can call your test suite "Safeway Web." Make sure to specify the URL of the target page in the right input:

https://www.safeway.com/pharmacy/create-account.html
Enter fullscreen mode Exit fullscreen mode

Username and password will not be used, so leave those fields empty.

The testRigor

Click "Create Test Suite" and you will be redirected to the test suite dashboard.

3. Add a Test Case

You should now be seeing the dashboard below:

Note the

Here, add your first test case to the suite by clicking the "+ Add Custom Test Case" button.

For example, assume you want to verify that the validation for "Phone" input in the form works as expected. You could define a "Phone Input Validation" test case as below:

Defining a new test case in testRigor

Launch it by clicking "Add and Run."

Here are the test steps in plain English:

click "Create Account"  
generate from template "########", then enter into "Primary Number (mobile)"  
click "Password"  
check that page contains "Please enter a mobile number that contains 10 digits"  
generate from template "##########", then enter into "Primary Number (mobile)"  
click "Password"  
check that page does not contain "Please enter a mobile number that contains 10 digits"
Enter fullscreen mode Exit fullscreen mode

Note that testRigor can generate random data for you following specific templates. You can also use RegEx expressions for data generation.

3. Run Your Test

The test case is now running and you will be able to monitor it in the "Test cases" list:

Note the status

Wait for the test to be executed. When the results are ready, click the chevron to expand the results and explore the test case run details:

Note the screenshots

The green status label indicates that the test case has been passed. Great, mission complete!

testRigor automatically takes screenshots for every test step, which provides excellent visibility and simplifies the debugging process when needed.

If this was not enough to figure out how the AI-based tool operated, you can play the video and see it in action on the target page:

The video of the test

Et voilà! Automated testing has never been easier with AI!

Additional Use Cases

Thanks to its AI-based engine, testRigor excels in many use cases where other automated tools struggle. Let's explore some of these scenarios where AI and ML make a big difference.

Working With Tables

testRigor provides intuitive commands that allow you to interact with table cells based on row and column values. These features work regardless of whether the table is a <table>, a <div>, or any other HTML element. To better understand how this works, consider the table below called "Actions:"

The

You can refer to table cells by specifying the value of the first cell in the row and the value of the header/top cell in the column.

Thus, this command will result in a click on the "Open channel" link:

click on table "actions" at row "103" and column "Action"
Enter fullscreen mode Exit fullscreen mode

You can also select a row based on the value it contains. The tool will check all the values in each row to find the one that matches the specified condition:

click on table "actions" at row containing "spk2" and column "Actions"
Enter fullscreen mode Exit fullscreen mode

This instruction will result in a click on the "Listen to" link.

testRigor supports many other operations on tables, including data validation, clicks, hover, data insertion, drag and drop, and more. Here are a couple of examples:

check that the second table at row containing "Nyota" and column "Action" contains the link "Open channel"  
click the first button within the context of the second table at row containing "Nyota" and column "Action"  
Enter fullscreen mode Exit fullscreen mode

Achieving the same result with traditional testing technologies would result in UI-coupled scripts involving complex logic.

Identifying and Handling Pop-Up Alerts

Pop-up alerts usually block user interaction and, if not handled properly, can lead traditional automated tests to failure. Every QA engineer knows that it is especially tricky to test disappearing pop-ups. With testRigor, you can easily identify pop-up alerts when they appear on a page. The tool provides powerful text commands to check for popups, close alerts, verify that their text contains a specific string, and more.

Visual Testing with OCR

testRigor offers powerful visual testing capabilities integrated with OCR (Optical Character Recognition) technology. This allows you to capture and extract text from visual elements, even in scenarios with traditionally visually-oriented components that are difficult to deal with, such as canvases, alerts, and closed shadow DOM elements. To enable the feature and start performing visual testing with OCR, you only have to add the using OCR instruction to a command.

Conclusion

In this article, you learned artificial intelligence is affecting the automated testing world. Traditional testing methods struggle to keep up with the increasing complexity of modern applications, causing maintenance problems and inefficiencies. On the other hand, an AI-based testing tool like testRigor reduces maintenance by more than 200 times and allows for desired test coverage to be achieved 15 times faster. testRigor offers a revolutionary approach to testing, and here you have the opportunity to see its plain English testing capabilities in action.

Thanks for reading! I hope you found this article helpful.


The post "How To Simplify Your Automated Testing With AI: A Beginner's Guide" appeared first on Writech.

Top comments (0)