Testing a DataBlade module is usually an iterative process, repeated several times until the code passes all the tests. The testing process has the following general steps:
1. Build the shared object file while logged on as user informix (if necessary).
1. Install the DataBlade module shared object, SQL scripts, and test scripts in the $INFORMIXDIR/extend/project directory.
1. Log on as the informix user and start your database server with the oninit command.
1. Create a test database.
1. Register the DataBlade module, using BladeManager (if necessary).
1. If you are replacing an existing shared object, shut down and restart the database server with the onmode -k and oninit commands.
1. Execute the functional tests.
1. Edit the source code (if necessary).
1. Regenerate the tests in BladeSmith (if necessary).
1. Repeat the procedure, as necessary.
textio_pos.sql
Text input/output functions for an opaque type; uses only valid test data.
textio_neg.sql
Text input/output functions for an opaque type; uses test data with invalid input data.
binio.sql
Binary file input/output functions; uses the valid input data for the opaque type.
textexp.sql
Text file import/export functions for opaque types; uses the UNLOAD and LOAD SQL statements.
binexp.sql
Binary file import/export functions for an opaque type; uses nested calls to the binary file import/export functions. The result of the nested calls should be equivalent to the text input format for the type.
notify.sql
The Assign/Destroy routines; inserts and deletes values in a new test table.
compare.sql
The Compare function for an opaque type.
equal.sql
The Equal function for an opaque type.
notequal.sql
The NotEqual function for an opaque type.
btree.sql
lessthan.sql
lessthanorequal.sql
greaterthan.sql
greaterthanorequal.sql
B-tree support functions for an opaque type.
rtree.sql
overlap.sql
contains.sql
within.sql
union.sql
size.sql
inter.sql
R-tree support functions for an opaque type.
plus.sql
minus.sql
times.sql
divide.sql
Standard math operators for an opaque type.
positive.sql
negative.sql
The Positive and Negate functions for an opaque type.
concat.sql
The concatenation operator; calls the Concat function for an opaque data type with two instances of the type.
hash.sql
The Hash support function with a SELECT...GROUP BY SQL query.
A script is only generated when the support routines it tests are defined. Adding Custom Test Files You can add other tests or initialization scripts to your test suite by adding your own scripts in the subdirectories of the functest directory and editing the sample user.sh shell script that BladeSmith generates. For example, you can add SQL scripts to create a test database, create special test tables in it, and execute custom tests against those tables. Executing Functional Tests To execute functional scripts, use the main.sh script. Execute a command in all test directories by executing the main.sh command in the top-level test directory. You can execute tests for a specific DataBlade module object by executing main.sh in that object's test directory. The first time you execute the tests, initialize the reference files. See "Initializing Reference Files" for instructions.
The TESTDB environment variable must be set to the name of the test database. Using the Functional Test Scripts The main.sh script is a Bourne shell script that accepts one of five possible command line parameters, as described in the following table.
main.sh build
Runs user.sh with a "build" target.
Runs the setup.sql script.
main.sh clean
Deletes .log files.
Runs user.sh with a "clean" target.
Executes clean.sql in the database.
main.sh run
Uses DB-Access to run each SQL script generated by BladeSmith, saving the output in a .log file.
If a .req file exists, calls diff to determine the test result. It prints a message telling whether the test passed or failed.
After all BladeSmith-generated tests are run, executes user.sh with a "run" target.
main.sh save
Copies all .log files to .req files, overwriting existing .req files.
main.sh all
Performs the "build," "run," and "clean" actions. Use this shortcut after the .req files have been saved.
Initializing Reference Files The first time you run tests, execute the "build" and "run" targets, as follows:
unknown (no reference file)