View on GitHub

mysql-unit

Testing framework for stored routines in MySQL

+--------------+---------------+---------+
| Installation | Documentation | Samples |
+--------------+---------------+---------+
1 row in set (0.00 sec)

Download this project as a .zip file Download this project as a tar.gz file

 

Testing results

This section describes what are testing results and how to interpret certain situations and sql codes. All testing procedures will continue run tests for specified function till first failure will occur. If that failure won't happen, then all tests were passed and success result will be returned.

So, testing result may be:

If error occured, then SQL Exception code will always be like 8****, which is specific for mysql-unit. Each code has it's meaning and may be used in external libraries to determine error reason.

Trace for failure

Testing trace will always contain same fields, but some of them may be NULL, depending of logical meaning of that field in terms of error, which had happened.

Full fields list is:

If all tests were successful, then testing trace won't appear. Also, testing trace is always represented with one and only one row set, which contains exactly one row.

SQL Codes for failure

Below is a list of SQL codes for exceptions, which are used in error state, which is sent to client, when testing procedure call faced a failure in some test:

Adding custom SQL codes

You are free to add codes with 8**** mask, but they should not conflict with reserved SQL codes. To make it safe, there is a reserved block for user-defined codes, it's 88***. Codes within that block will never used inside mysql-unit in future versions and can be safely used for user-defined SQL exceptions

User-defined SQL codes are like code 80500 - so, they have specific prefix only to show, that they belong to mysql-unit scope, but they are regular codes and may be used, for example, inside tests as expected error codes. The reserved 80*** codes can not be used there, since they have specific flow-control meaning.