Data-driven testing

In data-driven testing, a test container (test case/smart folder) retrieves input values from a data source such as an Excel spreadsheet or a database file. The test container is then repeated automatically for each row of data in the data source.

The key components of a data-driven test are variables, data sources, and data binding. You’ll learn how to combine these to build a data-driven test in the following chapters. A sample solution and accompanying instructions will guide you through the process.

Parameters are another component of data-driven testing. They increase module reusability and make it possible to pass variable values from one recording module to another.

Data-driven testing also allows you to use conditions to further control test execution, which is why this topic is explained at the end of the data-driven testing chapter.

In this chapter

Watch our on-demand webinar

Mastering Data-Driven Testing: If you prefer video instructions, you can also watch our on-demand webinar. Learn how to set up variables and link them to data sources. You will also learn how data binding connects variables to data items, how to control execution with conditions and how to pass values through module boundaries and across test cases.

Screencast

Download the sample solution

Except for the chapter on Conditions, each chapter in this section is dedicated to a separate part of building a data-driven test in Ranorex Studio and contains the necessary step-by-step instructions. Use the sample solution available below to put these instructions into practice. It comes with a prepared test suite and the required modules.

There is also a completed sample solution available in the chapter ⇢ Run a data-driven test. It contains the finished project after all the steps in the chapters have been completed. You can use it as a reference.

Sample solution

Install the sample solution:

Unzip to any folder on your computer.Start Ranorex Studio and open the solution file RxSampleDataDrivenTesting.rxsln

Hint

The sample solution is available for Ranorex versions 8.0 or higher. You must agree to the automatic solution upgrade for versions 8.2 and higher.

The process of data-driven testing

To get you started, here’s a quick overview of how data-driven testing works:

A test case contains the recording modules that make up the test. The recording modules, in turn, contain the actions that are carried out during the test run and the repository items these actions are performed on.

These actions and repository items can be made variable and bound to an external data source which provides the test data. During the test run, these variables are then fed with the values from the data source. The test is driven by data; therefore, it’s a “data-driven” test.

Like other actions, you can make validations variable as well. This allows you to verify whether the test data entered during a data-driven test produces the correct results in the AUT, i.e. if the actual result corresponds to the expected result. This is optional, but very useful. The sample solution that we’ll build in the following chapters includes a test-driven validation.

Recommended knowledge

To get the most from the examples in this chapter, we recommend a basic understanding of the material below:

Reference

To follow this chapter, you should have a working knowledge of the Ranorex fundamentals chapter, with the following chapters in particular: