The Curiosity Blog

Using Model-Based Testing to Generate Rigorous Automated Tests

Written by Mantas Dvareckas | 02 June 2021 10:42:51 Z

Despite increasing investment in test automation, many organisations today are yet to overcome the barrier to successful automated testing. In fact, only 15% of testing is currently automated [1].

Yet, the promise of increasing automation rates remains great for testers and their organisations. Test automation still holds the potential to increase quality, reduce costs, and lower test cycle times [1].

Clearly, something’s not right here. If automation has so many benefits, why has it not seen wider adoption? This article will consider some of the challenges that prevent effective test automation adoption, before discussing how model-based techniques can enable organisations to hit their desired rates of test automation.

“Manual” test automation is too slow and unsystematic

A key reason for low test automation rates is the manual and often unsystematic processes that surround the automation of execution. Slow and repetitive test case creation and scripting remain common. Meanwhile, low overall test coverage leaves systems exposed to costly bugs, with certain logic being wastefully tested repeatedly.

For example, let’s look at web UIs, which for many testers is the perfect place to start automating. After all, there are free web drivers, the logic maps clearly to business language, and the leap from test case to script appears relatively small. Yet, UI test automation frequently lags far behind UI changes, exposing organisations to costly bugs.

The truth is: test automation is not a magic plug and play solution. Building effective test automation can require substantial financial investment, skilled developers, and time. Fortunately, solutions exist to reduce this barrier to entry, making rigorous test automation viable. Model-based testing is one such approach, capable of enabling rigorous automated testing by overcoming the barriers holding organisations back.

Watch on demand! Curiosity and SelectorsHub present Generate Rigorous Automated Tests – and leave brittle test scripts behind! This webinar showcases a rapid, rigorous, and easy-to-adopt approach to building maintainable automated tests.

How is Model-Based Testing used in Test Automation?

“Model-Based Testing” or “MBT” elicits a range of reactions, not always positive. Some find it a daunting term, evoking a complex and sometimes unnecessarily-technical approach. However, model-based testing today can often be as simple as drawing pictures of the system, building intuitive flowcharts of the logic under test.

In this approach, visual flowcharts map out the cause-and-effect logic of the system, establishing a linked-up series of “if this, then this” statements. Each path through the flowchart then reflects a different scenario or test case, reaching an endpoint in the model that forms the expected result.

The mathematical precision of these models furthermore means that every test case or “path” can be identified automatically, drastically reducing the time spent on test case creation. Applying model-based techniques to test automation can also improve the quality of testing.

Model-Based Test Automation is a proven methodology for systematically and automatically identifying test cases associated with complex systems. It facilitates greater and more reliable functional test coverage, while increasing testing agility by automating both test asset creation and maintenance.

Furthermore, flowchart modelling is already frequently used by the BAs who gather requirements in BPMN style flowcharts. Flowcharts therefore enable testers to work collaboratively with BAs, minimising ambiguity, and incompleteness in requirements from day one. In fact, testing can occur from the moment the flowcharts are created, for truly parallel and “shift left” QA.

With the right tools and techniques, model-based testing can introduce the flexibility needed to update test assets in-sprint, as well as the QA resilience to continually generate rigorous automated tests.

Curiosity’s Test Modeller is one such tool, capable of rapidly creating flowcharts to generate rigorous automation scripts. This in turn minimises time lost to repetitive test case creation, maintenance, and scripting, boosting test automation across the software delivery lifecycle.

A visual flowchart or model used to automate testing by Test Modeller.

Lowering the barrier of entry to MBT and test automation

Test Modeller, is a flow-driven model-based tool which provides a range of accelerators and connectors for building flowcharts rapidly. This includes importers for existing requirements and test cases, as well as recordings and scans of already built systems. These accelerators are designed to significantly reduce the time and technical knowledge needed to model complex systems, unlocking the value of model-based test automation.

Model-Based Testing avoids the bottlenecks created by manual case design, test data allocation and automated test scripting. This can drastically improve testing speed, making it possible to test complex applications sufficiently, even in short iterations. Meanwhile, the logical precision of the models enables the application of test generation algorithms. These algorithms create the smallest set of tests needed to “cover” all the logic in the models, retaining test coverage while reducing test volume.

Let’s return to the earlier example of UI testing. Test Modeller enables a Model-Based approach to UI testing. Creating models for UI testing is quick, simple, and largely automated with Test Modeller. A browser extension, such as SelectorsHub, can be used to scan a UI, importing the scans to create logical models. Testers then simply select the elements to test, before using an automated generator to create the requisite scripts is generated. This avoids slow and repetitious scripting, while also enhancing functional test coverage.

You can see just how quick this approach is in this 3-minute example:

 

Alternatively, test and requirements importers can be used to rapidly build models of UIs, while visually stringing together reusable subflows to create end-to-end scenarios spanning multiple screens. The result is the same: reliable functional test coverage, without the delays caused by slow and repetitious test creation and scripting.

To top it all off, Test modeller identifies the data needed to test the UI logic. Every test generated from the model comes equipped with the test data needed to execute it. This up-to-date test data is found or made automatically during test creation. This is key to continuous, rigorous test automation and Test Modeller’s model-based approach makes it possible.

Rigorous Test Automation

Model-based approaches can be pivotal in overcoming the barriers to successful test automation. With Test Modeller, you can finally leave brittle test scripts behind and enjoy the benefits of rigorous automated testing.

To see Test Modeller in action, watch Curiosity and SelectorsHub present Generate Rigorous Automated Tests – and leave brittle test scripts behind! Now available on demand! This webinar showcases a rapid, rigorous, and easy-to-adopt approach to building maintainable automated tests. You will see how:

  1. SelectorsHub rapidly identifies UI elements and logic to test, replacing time spent hunting through complex UI code.
  2. Converting the scans into intuitive flowcharts generates custom scripts for open source and commercial frameworks, bringing coders and non-coders into close collaboration.
  3. Updating the central flows regenerates a complete set of up-to-date tests, throwing away broken tests to rapidly test fast-changing systems.
  4. Rapid test maintenance enables in-sprint testing, targeting regression testing to find bugs when they are quicker and easier to fix.

Follow Curiosity on LinkedInTwitterFacebook or subscribe to our YouTube Channel.

Footnotes:

[1] Capgemini (2020) World Quality Report 2020-21.