QA 2.0: Deep dive Part 1.1: testRigor

Chamila Ambahera
6 min readNov 24, 2023

--

This is Part 1 of the Deep dive into AI tools that will speed up test script implementation and improve the stability of the test executions.

I never thought to write an article for a commercial product. But here we are in the new world of AI.

Photo by Steve Johnson on Unsplash

In QA 2.0, the marriage of AI and human intelligence is not a full stop but a mere prologue — an introductory chapter to the infinite pages of a Smart Testing story. This is the birth of a tale where testing grows, transforms and adopts.

Quote by Chamila Ambahera

If you haven’t checked my previous articles, I recommend you start from the index page to understand the full context.

Welcome message

Consider the following code to verify the user welcome screen using Selenium and Java

package tests;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

public class TestSample {
@Test
public void login() {
System.setProperty("webdriver.chrome.driver", "path of driver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.browserstack.com/user/sign_in");
WebElement username = driver.findElement(By.id("user_email_Login"));
WebElement password = driver.findElement(By.id("user_password"));
WebElement login = driver.findElement(By.name("commit"));
username.sendKeys( ...charSequences: "abc@gmail.com");
username.sendKeys( ...charSequences: "your_password");
login.click();

WebElement welcomeXpath = driver.findElement(
By.xpath("//*[@id=\"wpbody-content\"]/div[2]/header[2]/div/nav/ul/li[5]/a/span");
)
String welcomeCXpathText = welcomeXpath.getText();
Assert.assertEquals(welcomeXpathText, s1: "Welcome Chamila");
}
}

Can you imagine that we can use AI to reduce the large chunk of code to this?

login
check if page contains "Welcome Chamila"

Welcome to the QA2.0 deep dive article series. :)

In this article, we are going to deep dive into the AI-powered tools that we can use to simplify the Selenium test automation effort.

As per their website

testRigor is an executable specification engine designed to allow anyone on your team to build, maintain and understand tests created and executed in plain English. We provide a Chrome plugin to speed up test creation, and our AI-powered system dramatically reduces test maintenance to a bare minimum and autonomously generates tests that reflect your end users’ behaviour.

  • Generate tests to reflect how users interact with your application.
  • Non-technical manual QA can build and maintain test automation while never falling behind.
  • Focus on your product, not code.
  • UI changes don’t affect test cases.
  • 20X less time to create tests with our Chrome extension.
  • 99.5% less time maintaining tests in testRigor compared to Selenium.
  • Manual QA and non-QA can now understand test failures.
  • 30 minutes or less to retest all functionality with parallel testing.

Here you can find more features of testRigor.

Let's find out if their claim is true.

I’m going to use https://www.saucedemo.com/ which is a famous site for practicing UI automation.

After Creating a free account I was prompted to enter details of my test suite.

I chose to generate 3 test cases using AI. So it prompted me following autogenerated test cases.

After clicking on the “Generate the tests” button testRigor automatically created those test cases and ran them for me. I found it has good basic coverage, especially with the Data Persistence and Consistency Check test case.

Data Persistence and Consistency Check test case.

Login
click "Open Menu"
click "Sauce Labs Bike Light"
click "Add to cart"
click "Back to products"
click "Sauce Labs Bike Light"
click "Remove"
click "Back to products"
click "Sauce Labs Bike Light"
click "Add to cart"

As per this test case, you can see it has good coverage to check data persistence.

If you write the same test script in Java, Selenium, Junit it will be like this

// Generated by Selenium IDE
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
import java.net.MalformedURLException;
import java.net.URL;
public class AddproductsTest {
private WebDriver driver;
private Map<String, Object> vars;
JavascriptExecutor js;
@Before
public void setUp() {
driver = new ChromeDriver();
js = (JavascriptExecutor) driver;
vars = new HashMap<String, Object>();
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void addproducts() {
driver.get("https://www.saucedemo.com/");
driver.manage().window().setSize(new Dimension(1552, 831));
driver.findElement(By.id("login_credentials")).click();
driver.findElement(By.id("login_credentials")).click();
{
WebElement element = driver.findElement(By.id("login_credentials"));
Actions builder = new Actions(driver);
builder.doubleClick(element).perform();
}
driver.findElement(By.cssSelector("*[data-test=\"username\"]")).click();
driver.findElement(By.cssSelector("*[data-test=\"username\"]")).sendKeys("standard_user");
driver.findElement(By.cssSelector(".login_password")).click();
driver.findElement(By.cssSelector(".login_password")).click();
{
WebElement element = driver.findElement(By.cssSelector(".login_password"));
Actions builder = new Actions(driver);
builder.doubleClick(element).perform();
}
{
WebElement element = driver.findElement(By.cssSelector("*[data-test=\"login-button\"]"));
Actions builder = new Actions(driver);
builder.moveToElement(element).perform();
}
driver.findElement(By.cssSelector("*[data-test=\"password\"]")).click();
driver.findElement(By.cssSelector("*[data-test=\"password\"]")).sendKeys("secret_sauce");
driver.findElement(By.cssSelector("*[data-test=\"login-button\"]")).click();
driver.findElement(By.id("react-burger-menu-btn")).click();
driver.findElement(By.id("react-burger-cross-btn")).click();
driver.findElement(By.cssSelector("*[data-test=\"add-to-cart-sauce-labs-bike-light\"]")).click();
driver.findElement(By.id("react-burger-menu-btn")).click();
driver.findElement(By.id("inventory_sidebar_link")).click();
driver.findElement(By.id("react-burger-cross-btn")).click();
driver.findElement(By.cssSelector("*[data-test=\"remove-sauce-labs-bike-light\"]")).click();
driver.findElement(By.cssSelector("*[data-test=\"add-to-cart-sauce-labs-bike-light\"]")).click();
}
}

It’s very long when we compared it to the testRigor generated plain English test script. Also if we need to add screenshots and videos we'll have to add more code.

Now let’s find out the custom test case generation feature in testRigor.

So I’m going to add a new custom test case for product checkout flow.

Click on “Add custom test case” to add a new test case. I entered the “Description” and clicked “Generate actual test using AI” see check what is that functionality.

Surprise!!!

Login
click "Sauce Labs Bike Light"
click "Add to cart"

It generated me few steps in my test case, so I can continue working on adding the rest of the functionality.

UI of the demo page

Based on the checkout flow and the above UI screen I added my next steps as per their documentation.

Login
click "Sauce Labs Bike Light"
click "Add to cart"
click "cart"
click "Checkout"
enter "Chamila" into "First Name"
enter "User" into "Last Name"
enter "1111" into "Zip/Postal Code"
click "Continue"
click "Finish"

Then click “Save and Retest”

It ran on the first try!!!

testRigor identified my English and found associated UI fields for that.

Also, I saw there is a button to generate a corner case. So I just clicked on it. It automatically generated negative scenarios for me. ;)

As I found they are not perfect. However, that will reduce the test script creation process massively. Also, it makes sure that we won’t miss those negative scenarios.

The test suite that I have set up on testRigor is public. If you are interested you can play on that.
https://app.testrigor.com/public/W8a3Ec6xtfAWS5G7e

If you want to learn more about testRiger, visit their website or their How-to-Articles

https://testrigor.com/how-to-articles/

Conclusion

While it is true that there are various similar firms in this area, TestRigor stands out due to its leverage on artificial intelligence to automate testing. However, traditional test automation demands time-consumptive and tedious work of handcrafting and maintaining scripts in order to follow the pace of today’s software products which are constantly changing. TestRoger is tackling through, utilizing AI algorithms which may autonomously develop and maintain the check scripts for the basis of alterations into an application’s owner interface.

TestRigor previews a better future as the world moves towards rapid and dependable software creation while providing artificial intelligence-based automation that enables applications to function without snags.

References

https://testrigor.com/

--

--

Chamila Ambahera
Chamila Ambahera

Written by Chamila Ambahera

Principle Automation Engineer | Arctic Code Vault Contributor | Trained Over 500 engineers

No responses yet