Search-Based Test Data Generation for SQL Queries

Conference Paper (2018)
Author(s)

J. Castelein (TU Delft - Software Engineering)

Maurício Aniche (TU Delft - Software Engineering)

M. Soltani (TU Delft - Software Engineering)

Annibale Panichella (TU Delft - Software Engineering)

A. van van Deursen (TU Delft - Software Technology)

Research Group
Software Engineering
Copyright
© 2018 J. Castelein, Maurício Aniche, M. Soltani, A. Panichella, A. van Deursen
DOI related publication
https://doi.org/10.1145/3180155.3180202
More Info
expand_more
Publication Year
2018
Language
English
Copyright
© 2018 J. Castelein, Maurício Aniche, M. Soltani, A. Panichella, A. van Deursen
Research Group
Software Engineering
Pages (from-to)
1220-1230
ISBN (electronic)
978-1-4503-5638-1
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

Database-centric systems strongly rely on SQL queries to manage and manipulate their data. These SQL commands can range from very simple selections to queries that involve several tables, subqueries, and grouping operations. And, as with any important piece of code, developers should properly test SQL queries. In order to completely test a SQL query, developers need to create test data that exercise all possible coverage targets in a query, e.g., JOINs and WHERE predicates. And indeed, this task can be challenging and time-consuming for complex queries. Previous studies have modeled the problem of generating test data as a constraint satisfaction problem and, with the help of SAT solvers, generate the required data. However, such approaches have strong limitations, such as partial support for queries with JOINs, subqueries, and strings (which are commonly used in SQL queries). In this paper, we model test data generation for SQL queries as a search-based problem. Then, we devise and evaluate three different approaches based on random search, biased random search, and genetic algorithms (GAs). The GA, in particular, uses a fitness function based on information extracted from the physical query plan of a database engine as search guidance. We then evaluate each approach in 2,135 queries extracted from three open source software and one industrial software system. Our results show that GA is able to completely cover 98.6% of all queries in the dataset, requiring only a few seconds for each query. Moreover, it does not suffer from the limitations affecting state-of-the art techniques.

Files

3180155.3180202.pdf
(pdf | 0.711 Mb)
License info not available