Data-Driven Testing: A Tutorial for QA Testers

Ghost Inspector is an automated web testing tool that helps QA testers and engineers to easily build, edit, and run low-code/no-code web tests. Start a free trial.
data driven testing

Picture this: you’re testing online registration forms, and you need to ensure that every input field in the form is working as expected. To do this, you build a manual test for one input field. And then another for a second. And then another for a third…and so on. Thankfully, this scenario isn’t likely to come true, and it’s all thanks to data-driven testing.

Not only does data-driven testing help ensure accuracy and precision in quality assurance, but it also minimizes the time required to run hundreds of test scenarios. Because this kind of testing uses a single test script that repeats over multiple sets of input data, QA testers can automate a comprehensive testing strategy that provides expansive test coverage without the hours that would be required to build so many test scripts.

Today we’ll detail the benefits of data-driven testing for QA testers, and we’ll walk you through how to get the most out of Ghost Inspector’s data-driven testing tools. Read on for the breakdown!

Table of Contents

Supercharge your automated testing workflow with Ghost Inspector

Our 14 day free trial gives you and your team full access. Create tests in minutes. No credit card required.

data driven testing framework

What is data-driven testing?

Data-driven testing is a type of software testing that uses test data from tables and spreadsheets to run robust test sequencing. This methodology allows testers to automate test cases more easily by providing a set of inputs and verifiable outputs that can be easily expanded or modified without having to build a whole new test script.

With data-driven testing, the test script and test data are separated, making it easier for the data sets to be interchanged and updated. This also ensures that test results are compiled efficiently after test runs. Data-driven testing allows a lone test script to automatically run hundreds of test cases from a table or spreadsheet, boosting efficiency and coverage. In addition, data-driven testing also allows for both positive and negative testing to be done at the same time, increasing test coverage even further.

Why is data-driven testing beneficial for QA testers?

Data-driven testing offers numerous benefits to QA testers. Rather than having to rely on coding skills to build an array of different tests, data-driven testing allows QA testers to build out spreadsheets that specify each different test case. Then, by using an automated testing framework like Ghost Inspector, the tester can feed tables and spreadsheets into the test automation tool and end up with an exhaustive, error-free, data-driven testing strategy. This way, QA testers who might not have strong coding skills can still provide excellent test data management.

Here’s how else QA testers benefit from running data-driven testing:

1. Increased Efficiency

When testers execute a variety of test scenarios using different inputs with just one test case, they save the hours of time that would be used up by the development team in building repetitive manual tests. By separating the test data from the test script, QA testers can essentially remove test writing from their test management workflow, expanding testing access to those without coding abilities and freeing up time for those who do have them.

2. Stronger Test Coverage

Data-driven testing allows for hundreds of test cases to be run across a wide range of scenarios, meaning that QA testers can cover hundreds of test cases off a single test script. Not only does this help streamline quality assurance, but it also creates a more effective regression testing strategy, as QA testers can immediately test software updates to determine if the upgrade in software has caused any regressions or functionality issues.

3. Simplified Maintenance

In data-driven testing, tests are stored within a data table or Excel sheet, making it easy for testers and developers to make updates and edits as needed without having to rewrite entire test scripts. And though QA testers might not be able to search through the code to make changes to a test case, they can easily make updates to the values assigned to a specific variable. 

4. Scalability

With a data-driven testing framework, QA testers can easily add data sets and increase the number of test scenarios without having to build out any additional test scripts themselves, expanding functional testing capabilities and removing roadblocks from quality assurance testing through automation. This software development method also significantly lessens the requirement for manual testing, allowing for a more cost-effective testing strategy that can be easily managed by leaner testing teams.  

Overall, data-driven testing is especially effective as part of a QA testing strategy, because it eliminates the need for repetitive test building and helps QA testers to test with greater efficiency while enacting a robust testing workflow. 

data checklist graphic

Data-driven testing with Ghost Inspector

With Ghost Inspector, QA testers can execute data-driven testing by uploading a CSV spreadsheet file with rows of values corresponding to the different test variables. Ghost Inspector integrates with external data sources, like CSV files and databases, allowing testers to easily update or extend data sets without needing to manually edit each test. Spreadsheets can also be saved in Ghost Inspector as a Data Source that can then be used again in the future.

When running data-driven testing using Ghost Inspector, testers should be conscious of the usage required for this specific feature, as it can prompt a high number of test runs. A spreadsheet with 200 rows of data for one test will initiate 200 test runs. If there are ten tests within the suite, then Ghost Inspector will initiate 2,000 test runs.

Step #1: Set Your Test Variables

Start by swapping one or more variables into your test step values. Example:

{{ firstName }}, {{ num }} and {{ square }} are swapped into the following test. These variables correspond with the headers in the CSV file.

screenshot of test variable parameters in Ghost Inspector

Step #2, Option #1: Executing with a CSV File

Run a test or suite with a CSV file one time by selecting More > Run Test with spreadsheet Data… from the test (or suite) main page. Each row of your uploaded spreadsheet will trigger a test or suite execution with the specified variable values.

execute with a CSV file screenshot for running a test with spreadsheet data

A pop-up window will appear that details the correct formatting guidelines for your CSV file. You can then select your spreadsheet file and upload it to this window. The first row of your CSV should list the names of your test variables. After the first row, each row should hold a unique set of data for the test, with each column’s test data matching the variable named at the top of that column.

confirmation box for "Run test with spreadsheet data" feature

Once you’ve uploaded your file, the window will show a summary of the variable data set to be used in your test runs. You can also specify how many rows can run at the same time by moving the Data Concurrency lever. When confirmed, the test or suite runs will start.

Data concurrency pop-up box in Ghost Inspector

You can also run tests or suites with a CSV file using our API. Simply include the file in a  in a POST request using thedataFile parameter.

Step #2, Option #2: Executing from the Data Source

Another method for executing data-driven testing with Ghost Inspector is by uploading CSV files to your organization and saving them as a Data Source for future use. To do this, navigate to Account Settings > My Organization > Data Sources in your account. There, you can choose a CSV file to upload and assign it a name for easy identification. After uploading a Data Source, options will be available to examine the data, update the CSV file, or remove it.

Pop-up for uploading spreadsheet and saving to data source

After uploading, link the new Data Source to your test or suite to execute. You can do this by going to your test, clicking on Settings > Data Sources, and then choosing the Data Source you’ve just added to your organization. Once linked, this Data Source will be utilized for all subsequent test runs, whether they’re initiated through the application, via API, on a scheduled basis, or through AWS CodePipeline executions.

Ghost Inspector test settings data source page

Important: When a Data Source is already assigned to a test or suite, if you want to run a single execution without it, you can do so by clicking Run Test with Custom Settings and setting the Data Source dropdown to None. When you run a suite, it will use only the Data Sources set for that suite, and you can also choose not to set any. If a Data Source is assigned directly to a test, it will be used only when that specific test is run on its own. If you’re dealing with more complex test data needs, it’s a good idea to create a separate suite for each Data Source that you plan to use. Then, simply add the relevant test to that suite.

"Run test with custom settings" variable pop-up box

Additional Options: Data Concurrency

Ghost Inspector’s Data Concurrency feature lets you specify the maximum number of data rows that can be run at a time. You can apply this setting at both the suite and test levels, and it affects both one-time CSV executions and test runs initiated with a Data Source. To change the Data Concurrency setting, head to Settings > Data Sources > Data Concurrency.

Conclusion

Data-driven testing plays a helpful role in the QA tester automated testing strategy. With this testing methodology, QA teams have the ability to run hundreds of test scenarios that can quickly and easily be modified and updated based on development needs. At the same time, this automation testing process ensures total accuracy, removing the consequences of human error from manual test-building.

With a test automation framework like Ghost Inspector, QA testers can easily perform advanced testing scenarios without holding high-level coding expertise. Ghost Inspector simplifies the data-driven testing process and helps ensure quality and reliability in browser testing. By using Ghost Inspector to execute data-driven testing, QA testers can be empowered to maintain software functionality, uphold quality standards, and boost their product’s reliability and user experience.

Supercharge your automated testing workflow with Ghost Inspector

Our 14 day free trial gives you and your team full access. Create tests in minutes. No credit card required.