SQLMutation
exposes a service to generate the SQL mutants from third party
applications using a REST API (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.
NOTE: The SOAP web service is being deprecated, but it is still accesible here.
Follow this link to get an overview of the mutation operators and new features
The service resource url is http://in2test.lsi.uniovi.es/sqlmutation/api/v2/mutants.xml
The service provides a POST operation that returns an XML string with the mutants of a given SQL query
The mutants.xml method requires a body with an XML string containing three items:
The service allways returns http status 200 with a string containing the mutants formatted in an XML document that can be further loaded and processed by any application.
The format of the result is explained below:
The root tag named<sqlmutationws>
which contains:
<version>
which contains a single text with the version number.
<sql>
which contains the SQL statement being mutated.
<error>
tag is returned if an error occurred during the mutation process.
The text inside displays an explanatory message.
<mutants>
tag is returned when the mutation is successful. It
contains all mutants generated and, for each of the
mutants:
<mutant>
tag representing a single mutant. Inside this tag:
<id>:
a sequence number, <category>:
the category of the mutant,
<type>:
the type of the mutant, <subtype>:
the subtype of the mutant)
<equivalent/>
tag in the case of an equivalent mutant.
<sql>
tag that contains a text with the mutated SQL
The third item in the input (optional) is a string which may include a set of options (separated by spaces) enclosed in the tag <options></options>
. Enclosed in this tag you may include one or more of the following tags:
noequivalent
: If present, the equivalent mutants are ommitted from the output
(if this option is not present the equivalent mutants are included and tagged with
<equivalent/>
).
nomutate=cat1,cat2...
: If present, specifies the categories or types that
will be omited from the output.
getgtime
: If present, an additional tag <summary gtime="nnn" />
before the mutants will include the time spent in generating the mutants in milliseconds.
hideids
: If present, ommits the number of each mutant and version. Only
for development.
getparsedsql
: If present, includes an additional tag with the original SQL
after being processed by the parser. Only for development.
POST http://in2test.lsi.uniovi.es/sqlmutation/api/v2/mutants.xml
Body:
<body> <sql>SELECT empname FROM staff WHERE empnum = 'E1'</sql> <schema> <table name="STAFF"> <column name="EMPNUM" type="char" notnull="true" key="true"/> <column name="EMPNAME" type="char"/> <column name="GRADE" type="decimal"/> <column name="CITY" type="char"/> </table> </schema> <options>nomutate=ir,nl</options> </body>
Response (mutants on categories IR and NL are are ommited as specified in options):
<?xml version="1.0" encoding="UTF-8" ?> <sqlmutationws> <version>2.2.0.dev<development /></version> <sql>SELECT empname FROM staff WHERE empnum = 'E1'</sql> <mutants> <mutant><id>1</id><category>SC</category><type>SEL</type><subtype>SLCT</subtype> <equivalent /> <sql> SELECT DISTINCT empname FROM staff WHERE empnum = 'E1'</sql> </mutant> <mutant><id>8</id><category>OR</category><type>ROR</type><subtype>RORW</subtype> <sql> SELECT empname FROM staff WHERE empnum <> 'E1'</sql> </mutant> <mutant><id>9</id><category>OR</category><type>ROR</type><subtype>RORW</subtype> <sql> SELECT empname FROM staff WHERE empnum > 'E1'</sql> </mutant> <mutant><id>10</id><category>OR</category><type>ROR</type><subtype>RORW</subtype> <sql> SELECT empname FROM staff WHERE empnum < 'E1'</sql> ... </mutants> </sqlmutationws>
POST http://in2test.lsi.uniovi.es/sqlmutation/api/v2/mutants.xml
Body:
<body> <sql>SELECT empname FROM staff WHERE empnum = 'E1'</sql> <options>nomutate=ir,nl</options> </body>
Response (still returns http status 200 but dispalys an error message because schema has not been specified):
<?xml version="1.0" encoding="UTF-8"?> <sqlfpc> <version>2.2.0.dev<development/></version> <sql>SELECT empname FROM staff WHERE empnum = 'E1'</sql> <error>Generation exception: SQLSchema.load: Table staff is not defined in the schema</error> </sqlfpc>
Open the Web application and then click the button "Submit Problem Report/Request for Enhancement" at the bottom of the form