DEV Community

Cover image for Smart Test Automation using NLP
Lavanya
Lavanya

Posted on • Edited on

Smart Test Automation using NLP

Development is fast-paced, so should be Testing to keep up with the accelerated delivery cycles. But Testing has not evolved at the same pace as Development. Even today, testers use age-old testing methods and tools to test complex applications.

Testing teams need to adopt automated test processes to keep up with the DevOps/CD advancements. As compared to Manual Testing, Automation Testing is best suited for changing application needs, to improve test effectiveness and coverage.

However, a few are still resistant towards Automation Testing mainly due to the huge scripting involved. Writing automated tests and maintaining the test scripts isn’t easy. This could be a bit of a struggle for someone new to Test Automation.

Automation Testers write super complex test scripts for each test case and are required to have a deep technical understanding of the underlying framework, application functionalities, programming knowledge, etc. It may take several lines of code to test even a small feature of an application.

Depending on the application type, Automation Testing requires expertise in multiple languages and technologies and a sudden shift towards Automation Testing can be a bit overwhelming for functional testers.

Also, Automation requires that the technical experts continuously monitor and maintain automated tests. Eventually, test automation becomes complex and unaffordable with an increased ROI time, especially, for small businesses.

A better approach with better collaboration and easy test authoring would be Scriptless Test Automation.

Scriptless Test Automation Approach

The biggest challenges in Automation Testing like we discussed is the initial time spent on test script development. The scriptless approach can speed up testing with better participation also, maximize the reusability of code with reduced maintenance.

Scriptless Automation tools hide/abstract the underlying code making the test automation process real easy and effortless. This will be particularly beneficial to Manual testing teams to automate complex applications efficiently even without scripting skills. With a huge part of the reusable tasks automated, they can also do a few rounds of Exploratory Testing.

This approach towards automation reduces time and effort required to test and ensure higher levels of maintainability and ease of updating changing requirements to fit into the Agile/DevOps process.

Benefits of going Scriptless

  • A Unified approach to diverse application types on multiple browsers and platforms
  • Less or no learning curve
  • Easy updating of changes and updates
  • Test scripts can be reviewed by domain experts and business analysts
  • A reduced test authoring time and faster Return On Investment

The main challenges with legacy test automation are building a robust and maintainable automation framework and managing the objects and identifiers.

Automated tests need to be reusable and maintainable and should not be resistant to changes in the application UI and should ensure that the automated tests do not break. Today with "self healing" tests that automatically takes care of flaky tests, this is no longer an issue.

NLP in Testing

A new advancement in Scriptless Test Automation is Natural Language Processing(NLP) that is used to write simple tests in natural understandable language.

The application of NLP reduces test creation time and is done in a format that is intuitively easy to for anyone to quickly adapt and use. Tools like Testsigma use simple plain English to automate tests and the changing UI elements are maintained by AI.

The tests are as simple as "Go to https://testsigma.com”,
“Enter Name in the Username field”,
“Verify that the page displays text Testsigma, etc.

NLP techniques were initially considered puerile and inadequate. However, over the years, NLP has advanced. Some of our day to day applications like Siri, Alexa, autocomplete in emails, etc that try and cut down our manual efforts are a few examples of this.

The NLP based tests can accommodate changes anytime and can easily be edited(if required). NLP makes it easier to automate all of your test cases and tightly integrate them with your dynamic delivery pipeline while optimizing user experience.

Let’s look at a few additional features that would boost test automation.

1. Smart Element locators

Once the Tests are created and ready, Test maintenance is the next hurdle a tester has to go through. Undesirable Test maintenance wastes productive time that could be used for manual feature checks and increasing test coverage.

It ensures that the Functional Tests doesn’t break even if the product undergoes radical change. The tests will stay strong in the tide of code changes.

2. Conditional waiting

Conditional waits allow avoid ‘dead waits’ that pauses the Execution for a specified amount of time even if the condition we are waiting for becomes true halfway.

NLP based test automation tool, Testsigma has an extensive set of Conditional Wait statements which helps to add waits based on user-defined conditions:

Wait until the current page is loaded completely
Wait until the element ui identifier is clickable
Wait until the element ui identifier is selected
Wait until the element ui identifier is visible & many more…

3. Conditional flow and Control Structures

Controls Structures provided by programming languages is one of the most powerful features available in Selenium. This allows defining different test flows to loop a set of Test Steps multiple times based on specific conditions.

Imagine the same set of features available in a Scriptless tool without the added complexity.
With Testsigma, you can either loop on a whole Test Case with a set of parameters(data-driven approach) or loop on a subset of Test Steps. This is especially useful if we want to simply repeat a step multiple times with/without an available Test Data set.

4. Easy Assertions in scriptless test automation

Creating the navigation steps alone doesn’t add any value to the Tests. The real value comes with the Assertions. Assertion verifies that the required business logic is implemented properly and works in a way the Product owner wants it to.

Adding Assertions in Testsigma is similar to adding Conditional waits – using already available Verification statements.

Here’s a set of Assertions available by default:

Verify that an Alert with text test data is displayed
Verify that the ui identifier checkbox is disabled
Verify that the ui identifier list has option with text test data selected
Verify that the Alert displays the message test data
Verify that the count of elements identified by locator ui identifier is test data and lot more.

5. Modifications without redo

Record-and-Playback tools do not permit easy editing of recorded tests. The Tester has no choice but to re-record the Test Steps from the beginning of the flow if the application changes even slightly. This is far from ideal. This is explained more in detail in Why is Record and Playback not suitable for enterprise-class Test Automation?

Like we mentioned earlier, Modification is a piece of cake when it comes to NLP based test scripts and permits to add Test Steps at the beginning, end or anywhere in between easily without redo.

6. Reusable Steps in Scriptless Test Automation

In scenarios similar to "Login" of an an application, it would be a redundant effort to create the same steps for each of the Test Cases. Therefore, it is necessary to provide some mechanism with which we can group a set of Test Steps for repeated use.

7. Cross-browser Support

With a plethora of devices(Desktop or Mobile) used by end users, we need to make sure the app functions as intended on all those devices. You may use Analytics tools such as Google Analytics to find out device usage patterns.

Now with Cloud Based Scriptless Testing solutions, automated tests can be run on thousands of real Device/OS/Browser versions combo and also local physical devices.

8. Test Reporting and Analytics

Testsigma provides a detailed Test Report for all the Test Case executions that consists of a powerful visual feedback system with step by step visual reports.

Each of the Test Step has a passed/failed status indicator and screenshots that denote the state of the Application when the failure occurred.

In some cases, the Test Case can fail at a step and the error might propagate down unnoticed until the next assertion. Step by step analysis in Scriptless Test Automation tools like Testsigma includes Screenshots and logs that helps us to understand the actual step where the Test failed.

You can easily figure out what went wrong using the Test Execution video logs that help pinpoint the step which deviated from the actual Test Case also gives a quick analysis as to how our tests are performing over a period of time.

9. Ability to insert code

If you need to use the power and flexibility of Code, you can create Custom Functions to write code and create your custom test scripts in addition to the NLP based grammar steps.

10. Continuous Integration

With necessary third party tools' integrations(Team Collaboration tools, Bug Tracking tools, ALM tools and CI tools), you could bring all your testing resources together thereby achieving Continuous Testing.

In addition to plain natural language test creation, a few additional features that Testsigma offers include:

  • Possible Failure Detection – Affected Test Cases
  • Test Management Capabilities(Requirements, Test Suites, Test Case priorities e.t.c)
  • Automatic Bug Reporting(JIRA)
  • Shared Object Repository
  • State Management



With the simplicity of NLP based tests, flexible, easily understandable tests can be created which well suits Agile development and allows for iterative delivery of quality software!

Image credit: Business vector created by freepik - www.freepik.com

Top comments (0)