Relational symbolic execution of SQL code for unit testing of database programs

Résultats de recherche: Contribution à un journal/une revueArticle

86 Downloads (Pure)

Résumé

Symbolic execution is a technique enabling the automatic generation of test inputs that exercise a set of execution paths within a code unit to be tested. If the paths cover a sufficient part of the code under test, the test data offer a representative view of the actual behaviour of this code. This notably enables detecting errors and correcting faults. Relational databases are ubiquitous in software, but symbolic execution of code units that manipulate them remains a non-trivial problem, particularly because of the complex structure of such databases and the complex behaviour of SQL statements. Finding errors in such code units is yet critical, as it can avoid corrupting important data. In this work, we define a symbolic execution translating database manipulation code directly into constraints and integrate it with a more traditional symbolic execution of normal program code. The database tables are represented by relational symbols and the SQL statements by relational constraints over these symbols. An algorithm based on these principles is presented for the symbolic execution of simple Java methods that implement transactional use cases by reading and writing in a relational database, the latter subject to data integrity constraints. The algorithm is integrated in a test generation tool and experimented over sample code. The target language for the constraints produced by the tool is the SMT-Lib standard and the used solver is Microsoft Z3. The results show that the proposed approach enables generating meaningful test data, including valid database content, in reasonable time. In particular, the Z3 solver is shown to be more scalable than the Alloy solver, used in our previous work, for solving relational constraints.

langue originaleAnglais
Pages (de - à)44-72
Nombre de pages29
journalScience of Computer Programming
Volume105
Date de mise en ligne précoce10 avr. 2015
Les DOIs
étatPublié - 1 juil. 2015

Empreinte digitale

Testing
Surface mount technology

Citer ceci

@article{1538c005fe774fef9e5af1ccb990c315,
title = "Relational symbolic execution of SQL code for unit testing of database programs",
abstract = "Symbolic execution is a technique enabling the automatic generation of test inputs that exercise a set of execution paths within a code unit to be tested. If the paths cover a sufficient part of the code under test, the test data offer a representative view of the actual behaviour of this code. This notably enables detecting errors and correcting faults. Relational databases are ubiquitous in software, but symbolic execution of code units that manipulate them remains a non-trivial problem, particularly because of the complex structure of such databases and the complex behaviour of SQL statements. Finding errors in such code units is yet critical, as it can avoid corrupting important data. In this work, we define a symbolic execution translating database manipulation code directly into constraints and integrate it with a more traditional symbolic execution of normal program code. The database tables are represented by relational symbols and the SQL statements by relational constraints over these symbols. An algorithm based on these principles is presented for the symbolic execution of simple Java methods that implement transactional use cases by reading and writing in a relational database, the latter subject to data integrity constraints. The algorithm is integrated in a test generation tool and experimented over sample code. The target language for the constraints produced by the tool is the SMT-Lib standard and the used solver is Microsoft Z3. The results show that the proposed approach enables generating meaningful test data, including valid database content, in reasonable time. In particular, the Z3 solver is shown to be more scalable than the Alloy solver, used in our previous work, for solving relational constraints.",
keywords = "Software Testing, Symbolic Execution, Constraints, Satisfiability Modulo Theories (SMT), Alloy, Quantifiers, First-Order Logic, Relational Algebra, Structured Query Language (SQL), Database, Database Applications",
author = "Micha{\"e}l Marcozzi and Wim Vanhoof and Hainaut, {Jean Luc}",
year = "2015",
month = "7",
day = "1",
doi = "10.1016/j.scico.2015.03.005",
language = "English",
volume = "105",
pages = "44--72",
journal = "Science of Computer Programming",
issn = "0167-6423",
publisher = "Elsevier",

}

Relational symbolic execution of SQL code for unit testing of database programs. / Marcozzi, Michaël; Vanhoof, Wim; Hainaut, Jean Luc.

Dans: Science of Computer Programming, Vol 105, 01.07.2015, p. 44-72.

Résultats de recherche: Contribution à un journal/une revueArticle

TY - JOUR

T1 - Relational symbolic execution of SQL code for unit testing of database programs

AU - Marcozzi, Michaël

AU - Vanhoof, Wim

AU - Hainaut, Jean Luc

PY - 2015/7/1

Y1 - 2015/7/1

N2 - Symbolic execution is a technique enabling the automatic generation of test inputs that exercise a set of execution paths within a code unit to be tested. If the paths cover a sufficient part of the code under test, the test data offer a representative view of the actual behaviour of this code. This notably enables detecting errors and correcting faults. Relational databases are ubiquitous in software, but symbolic execution of code units that manipulate them remains a non-trivial problem, particularly because of the complex structure of such databases and the complex behaviour of SQL statements. Finding errors in such code units is yet critical, as it can avoid corrupting important data. In this work, we define a symbolic execution translating database manipulation code directly into constraints and integrate it with a more traditional symbolic execution of normal program code. The database tables are represented by relational symbols and the SQL statements by relational constraints over these symbols. An algorithm based on these principles is presented for the symbolic execution of simple Java methods that implement transactional use cases by reading and writing in a relational database, the latter subject to data integrity constraints. The algorithm is integrated in a test generation tool and experimented over sample code. The target language for the constraints produced by the tool is the SMT-Lib standard and the used solver is Microsoft Z3. The results show that the proposed approach enables generating meaningful test data, including valid database content, in reasonable time. In particular, the Z3 solver is shown to be more scalable than the Alloy solver, used in our previous work, for solving relational constraints.

AB - Symbolic execution is a technique enabling the automatic generation of test inputs that exercise a set of execution paths within a code unit to be tested. If the paths cover a sufficient part of the code under test, the test data offer a representative view of the actual behaviour of this code. This notably enables detecting errors and correcting faults. Relational databases are ubiquitous in software, but symbolic execution of code units that manipulate them remains a non-trivial problem, particularly because of the complex structure of such databases and the complex behaviour of SQL statements. Finding errors in such code units is yet critical, as it can avoid corrupting important data. In this work, we define a symbolic execution translating database manipulation code directly into constraints and integrate it with a more traditional symbolic execution of normal program code. The database tables are represented by relational symbols and the SQL statements by relational constraints over these symbols. An algorithm based on these principles is presented for the symbolic execution of simple Java methods that implement transactional use cases by reading and writing in a relational database, the latter subject to data integrity constraints. The algorithm is integrated in a test generation tool and experimented over sample code. The target language for the constraints produced by the tool is the SMT-Lib standard and the used solver is Microsoft Z3. The results show that the proposed approach enables generating meaningful test data, including valid database content, in reasonable time. In particular, the Z3 solver is shown to be more scalable than the Alloy solver, used in our previous work, for solving relational constraints.

KW - Software Testing

KW - Symbolic Execution

KW - Constraints

KW - Satisfiability Modulo Theories (SMT)

KW - Alloy

KW - Quantifiers

KW - First-Order Logic

KW - Relational Algebra

KW - Structured Query Language (SQL)

KW - Database

KW - Database Applications

UR - http://www.scopus.com/inward/record.url?scp=84929704309&partnerID=8YFLogxK

U2 - 10.1016/j.scico.2015.03.005

DO - 10.1016/j.scico.2015.03.005

M3 - Article

AN - SCOPUS:84929704309

VL - 105

SP - 44

EP - 72

JO - Science of Computer Programming

JF - Science of Computer Programming

SN - 0167-6423

ER -