STCG: a SQL Test-Case Generator

by Rafael Caballero, José Luzón-Martín and Antonio Tenorio

STCG is a test-case generator for SQL queries. Starting with a set of related SQL views that can include existential subqueries in the conditions, the tool produces a database instance that can be used as a test-case for the target view. The proposal reduces the problem of generating the test-cases to a Constraint Satisfaction Problem using finite domain constraints. In particular, it is based on a new approach for existential conditions that makes possible to find test-cases for a wider set of queries.

* Requirements.

The application requires the existence of the following packages/applications. For compiling the source code:

  • bison
  • flex
  • g++

For running the application: stcg generates minizinc code, that can be runned installing

* Source code

The source code can be obtained from the STCG subversion repository using this subversion command:

svn checkout stcg

(stcg can be replaced by any folder name you prefer)

  • To compile in linux
    • Move to the stcg folder
    • Type in the linux shell

make; sudo make install

Now the program is built and installed

* Linux executable

To execute a complete pipeline of our tool with input file input.sql run the following command line:

cat input.sql >> output.sql; stcg -i input.sql -o output.mzn; minizinc output.mzn >> output.sql

* SQL script example