Here at mabl, we are always thinking about better ways to help you increase your test coverage. We believe that test creation should be seamless and tests should evolve alongside your app. As the scenarios available to your users become more complex, mabl simplifies the process of creating tests that are both reusable and versatile.

Data-driven testing is one of the most powerful tools in your regression testing toolbox. In minutes, you can increase the coverage that an automated test provides by an order of magnitude; just replace your hard-coded values with variables, link the test to a datatable, and let mabl handle the rest. Let’s walk through a simple example.

Using variables and datatables

Let’s begin with a test that visits a website and searches for jobs using a hard-coded keyword, “engineer”, and asserts that there should be some number of openings.UdvgWM94FquYu75_5kimV0u3mRopNpMiw9lY4odXvCa8PfXyDj7CDxBm33j0pcE_sYmg8V-2dIzsvoOey9PcWELAc2mGhVTg-b6aK6YbCpjeqj8rq_iavQY0XUtqoDHCDXD3yCoW
While this is a good start, there are other job openings available here. I’d like to verify that the search page works with different types of openings, not just “engineer”, without creating a new test for each type.

I start by creating a new variable, “Job_Type”, which I’ll set via a new data source.

datadrivenblog_image2

Next, I edit the step that enters the text to use the new “Job_Type” variable rather than the existing hard-coded string and save the test.

HH39bt3EO8qP2ktQdqROMxzdHIdHCnnSLxq__ZK_yxvAJ8ce2RRNOAlG6Er_cXTGI9sz8i_S6tFi9kMqRCbNY842E4kt45h6npvmXsYtMVvVJI7zX-3qSuko-ZLVU0In2qgcBjjDFrom the test details page within the mabl app, I then generate a new datatable. I define all the scenarios that I want to test and I save the datatable.

datadrivenblog_image4

Finally, I run the test using the new datatable.

datadrivenblog_image5Success! I can see that mabl correctly used the datatable to test each of the scenarios in parallel. From this screen shot, for example, you can see that mabl successfully searched for and found a “marketing” role.

H58HNu9bHCipny2rEJNE7yTKlyk1PrrjTfgNWmVjSqLl2vdGBwtm93quj4AOtBro-vHhlHFTO7N5weFH9hBi-NBi6kchKVL6SEfNssBiQoUHpynYfOijWeTvVImEbSGSVuwF-LIV

Parameterize steps and reuse datatables

In practice, your scenarios are probably more complex. Fortunately, you can extend your test and datatable to parameterize additional steps. You can also reuse datatables across many tests and even upload your existing data.

As always, we recommend starting simple and adding more power from there. Whether you’re a seasoned automation engineer, a QA engineer, or a manual tester making the transition to low-code test automation, we hope this example helps you get started on the path to improve coverage by integrating data-driven testing into your regression suite.

Sign up for a free trial of mabl to get started building your data-driven tests today.