Blog

Model-based and record & playback automation techniques: The ultimate guide

Author:

Simona Domazetoska

Product Marketing Manager

Date: Mar. 28, 2023

Model-based test automation and record and playback — have you heard these buzz phrases before in the world of software testing? They’re two similar approaches to testing, yet they’re vastly different in their execution. But what exactly is the difference between these two techniques and why does it matter?

What is model-based test automation?

Model-based testing is a technique in which a model of the software system is used to generate test cases. The model is typically a visual representation of the system’s UI components. Each model consists of functional actions that can be performed on the system or application. Test data is added separately to test different scenarios. The advantage of this approach is that it allows for testing a variety of scenarios without hard-coding test data or business logic into the models. The model is used to automatically generate test cases that cover various scenarios and test conditions, making it useful for complex scenarios that rely on several integrated applications and technologies. The models are code-free and highly reusable.

How does it work? Simply scan your application’s user interface or API to create the models. Drag and drop the models into place to create your test cases. Add your test data and the functional actions you want enacted on those screen elements. When done, run your test case.

How model-based testing works

What is record and playback?

Record and playback is a test automation method that allows testers to record their interactions with the software system and then replay those interactions as test cases. When recording your actions with the application, the steps are saved as a series of test steps. These test steps can be modified in an editor to add or remove steps, insert data, add assertions, and so on, resulting in a test case. The recorded interactions are typically user actions, such as clicks and key presses.

Record and playback testing maintains a tighter link between the objects, test logic, and data. However, data can be separated through a process called parameterization.

Other terms have evolved for record and playback testing such as activity-based testing, flow-based testing, or testing the user path or journey across an application. In general, this approach is simple to use and offers a quick, efficient way to author tests for repetitive and time-consuming tasks.

What are the advantages and disadvantages of each method?

Model-based test automation provides benefits such as being highly reusable, codeless, easy to maintain and update, and able to test a variety of scenarios. This can help to reduce maintenance while providing greater stability to the testing process. Because of its codeless approach, model-based testing lowers the barrier to entry, meaning that any team member regardless of technical skillset can create test assets, boosting overall team productivity. Because model-based testing separates the object discovery from test case creation, it can require more up-front time to create test cases than a record-based approach. The tradeoff is that model-based design separates the testing model from the underlying technology, which can help test case reusability when the system under test undergoes major changes but the business logic remains intact.

Record and playback, on the other hand, is a quick and simple method for authoring test cases that is particularly well-suited for Agile teams wanting to prioritize speed of testing over long-term maintenance. It is also more suited for developers wanting to do quick validation of their code at the unit level. However, its biggest drawback is that when significant changes are made to the application under test, such as updating the page design, it may require you to re-record that part of the journey. In many cases, record and playback solutions use AI-generated and auto-improving multi-attribute locators to reduce maintenance and provide a more efficient way to deal with minor UI application changes.

When do you use model-based testing vs. the record and playback method?

One of the main differences between these two approaches is that model-based testing has a much higher level of abstraction between the user’s test actions from the underlying technology of the application, whereas record-based testing has a tighter coupling between the two. This means that model-based testing is better suited for testing a wider range of scenarios across multiple integrated applications where the scope of testing may be larger. In essence, model-based testing is better suited for “regression testing,” and is considered the secret sauce behind reducing long-term maintenance. Record-based testing, on the other hand, is better suited for quickly testing individual apps that are required for agile development. This makes record and playback better for “progression testing.”

When deciding between the two methods, consider the size and complexity of the application or multiple applications concerned for an end-to-end flow, the frequency of changes to the application, and the level of expertise of the testers. Both methods can offer no-code/low-code options that make them easy to adopt. Either approach can be used to ensure that the software application is fully tested and working correctly, but it depends on the objective of the testing process.

Here is a useful summary of some notable differences between the two approaches:

Authoring

  • Model-based testing: Authoring tends to be more deliberate. Users craft models to test a variety of use cases. Models contain the scanned elements. Models are dragged and dropped onto test cases to add functional actions, and assertions into a series of test steps.
  • Record and playback: Authoring is performed by interacting with the UI to create a series of steps.  Once completed, you can go back to the visual representation of the testcase and modify it by editing or removing steps, adding assertions, etc.

Reuse

  • Model-based testing: Models can be reused in other test cases. Test cases can be reused in other test cases.  Test cases across apps can be connected into one workflow for broader end-to-end use cases.
  • Record and playback: Each test step (object + action) can be shared with other test cases.  Groups of test steps can be shared with other test cases.

Maintenance

  • Model-based testing: When the underlying application changes, updating the objects that changed will update all dependent test cases. This means there is a single point of maintenance. The business logic and data are separate so test cases can be more easily updated in the event of major app changes (e.g., desktop to cloud).
  • Record and playback: More sophisticated record and playback solutions use AI-generated and auto-improving multi-attribute locators to stabilize test automation. They also allow changes to objects to be updated in one area and reflected in impacted tests.

Primary use cases

  • Model-based testing: QA testing of business processes that span multiple applications.
    • Web-based business apps (e.g., SAP Fiori updates, Oracle Cloud, Workday, etc.)
    • E2E testing / streamlining business processes, e.g., supply chain, lead to cash, order management, etc.
  • Record and playback: Supports agile development
    • Custom web apps that support specific LOBs
    • Consumer-facing apps

Sample scenario

Suppose a company sells products through a web app. On the back end, it’s connected to Salesforce for account management, SAP for inventory management, NetSuite for billing, and Amazon Web Services to deliver custom-built services.

  • Model-based testing: You scan all components from all applications in the end-to-end flow. You add the business logic, assertions, and data to create a test case. For example, for the website you would scan: product and service catalogs, add-to-cart functions, and checkout.You not only test your website, but also its integration with Salesforce for account verification, SAP for inventory availability and pricing, and NetSuite for billing. You could test your web app’s integration to these other tools through API testing. However, you might also want to verify that the other connected applications are behaving as intended. Thus, you would want an end-to-end test that flows across these different apps.
  • Record and playback: You would start by recording a flow and interacting with the application, testing a predefined path through the application.When you are done with the recording you would do some post-editing to ensure that the test case flow doesn’t have unnecessary steps, has assertions, add data, etc.You could do similar things with other web-based apps, testing that each module is functioning as intended.With most record and playback solutions, there is no way to string together the different apps into a true end-to-end test case that leverages the output of one app as the input to another part of the process.

Key points to consider

  • Business process complexity: Consider the complexity of the business process you are testing. How many integrated technologies and applications are involved? Are they web-only, or does it include desktop? Think of order to cash, source to pay, demand to warehouse. Industries such as retail, banking, manufacturing, or energy contain long and complex business processes that require model-based testing, which offers a more sophisticated approach for end-to-end testing.
  • Single application agility: Agile teams building customer-facing applications tend to prioritize speed of testing over long-term maintenance. Stability and maintenance are important, but AI-powered self-healing or auto-improving locators is typically sufficient to handle minor UI changes. Record-based solutions can enable developers or Agile testers to more quickly create tests to validate newly developed in-sprint features.
  • Test coverage: Model-based testing can potentially achieve higher test coverage than record and playback testing. This is because model-based testing can generate test cases based on a variety of scenarios, whereas record and playback testing is limited to the actions that were recorded.
  • Test maintenance: Model-based testing can be more maintainable in the long run since it is based on separating the user’s functional actions on the screen objects from the test cases. Changes to the system can be reflected in the model, and the tests can be automatically updated to reflect those changes. Record and playback tests may however equally be as effective, particularly when self-healing technologies are implemented to auto-update changes to tests.
  • Skillset required: Both model-based testing and record and playback offer codeless approaches to testing, lowering the barrier to adoption for non-technical personas or citizen developers. Model-based testing may require more business expertise in modeling the application flow initially. However, this may also enhance collaboration with testers and business stakeholders by having a common, no-code interface to review.

In conclusion, both record and playback and model-based test automation have their place in the world of software testing. Record and playback fits best for single application use cases when the team is prioritizing speed over long-term maintainability. Conversely, model-based test automation can provide greater flexibility and stability while lowering maintenance costs when testing across multi-app business processes.

Read here to learn more about how to leverage SaaS model-based testing to drive speed and agility of your end-to-end application development.

Author:

Simona Domazetoska

Product Marketing Manager

Date: Mar. 28, 2023

Related resources

You might also be interested in...