SQLMutation Web Service - Generation of mutants for testing SQL database queries

SQLMutation exposes a Web service to generate the SQL mutants from third party applications (alternatively, the mutants can be generated interactively from a browser). In order to get started on how to integrate an application using the service, read the following information:

  1. SQLMutation Overview
  2. Specification of the Web service
  3. Sample code of a Web service Client
  4. Submit a Software Problem Report/Request for Enhancement
  5. Release notes & new features
  6. Getting started with SQLMutation (Web interface)

1. SQLMutation Overview

Follow this link to get an overview of the mutation operators and new features

2. Specification of the Web service

Links to the Service:

2.1. Operations

The web service provides two operations:

2.2. Inputs

The Web service exposes a the above operations that take take three strings as input:

  1. sql : A string containing the SQL of the query to be mutated. Take into account some issues on how to specify the SQL.
  2. schema : A string containing an XML representation of the database Schema. See the instructions on how to specify the database schema.
  3. options: Additional parameters (see Additional options).

2.3. Outputs

The service returns a string containing the mutants formatted in an XML document that can be further loaded and processed by any application. If getMutantsCompressed is used, the result must be first decompressed using the standard ZIP algoritm (in Java or JSharp, use java.util.zip.Deflater).

The format of the result is explained below:

The root tag named <sqlmutationws> which contains:
  1. A header tag named <version> which contains a single text with the version number.
  2. A tag named <sql> which contains the SQL statement being mutated.
  3. A tag with the result of the mutation. This can be one of the following:
    1. The <error> tag is returned if an error occurred during the mutation process. The text inside displays an explanatory message.
    2. The <mutants> tag is returned when the mutation is successful. It contains all mutants generated and, for each of the mutants:
      • A <mutant> tag representing a single mutant. Inside this tag:
        • A set of identification tags that classify the mutant (<id>: a sequence number, <category>: the category of the mutant, <type>: the type of the mutant, <subtype>: the subtype of the mutant)
        • An optional <equivalent/> tag in the case of an equivalent mutant.
        • The <sql> tag that contains a text with the mutated SQL

This is an example of a returned XML including two mutants:

<?xml version="1.0" encoding="UTF-8"?>
<sql>SELECT empname FROM staff WHERE empnum = 'E1'</sql>
<sql>SELECT DISTINCT empname FROM staff WHERE empnum = 'E1'</sql>
<sql>SELECT STAFF.EMPNUM FROM staff WHERE empnum = 'E1'</sql>

This is an example of the returned XML when an error occurred:

 <?xml version="1.0" encoding="UTF-8"?>
<error>Exception while mutating query: SQLParser.new: SQL query is empty</error>

2.4. Additional options

The third parameter of the web service methods is a xml character string which may include a set of options enclosed in the tag <options></options>. Enclosed in this tag you may include one or more of the following tags:

3. Sample code of a Web service Client

You can download two different implementations of a sample client (written in Java and VB.NET). Both programs present a single window with:

  1. A text area to specify the SQL query.
  2. A text area to specify the database schema in XML format.
  3. A button to generate the mutants. If an error occurs with the connection an error message will be displayed.
  4. A text area with the result.

3.1. Sample Java Client

The client has been written in Java using the Eclipse v3.2 environment with the Eclipse Web Tools Platform (WTP) v1.5.0. The WTP is needed to create the proxy classes cecessary to connect to the web service:

  1. Download the ZIP file containing the Java sample client and decompress it to a local folder.
  2. Create an Eclipse project using the existing source in folder java.eclipse.wtp as the project location.
  3. Locate the class Client.java in the package in2test.samples.sqlmutationws.java at the src folder.
  4. Run it as Java Application

The class Client.java is a Swing application which has a method callService() that connects the service by calling the proxy object created with the WTP.

3.2. Sample VB.NET Client

This client has been written in VB.NET using Developer Studio 2005 and .NET Framework v2.0

  1. Download the ZIP file containing the .NET sample client and decompress it to a local folder.
  2. Open the solution located in folder vb.net by double clicking the file SQLMutationWSClient.sln. This will open the development environment.
  3. Run the application.

The main class is Client.vb which has a method generate_Click(...)that connects the service by calling the proxy object that has been created as a Web reference using the development environment.

4. Submit a Software Problem Report/Request for Enhancement

Open the Web Interface and then click the button "Submit Problem Report/Request for Enhancement" at the bottom of the form