Oninit® ifxTAP — Unit Testing for Informix®
ifxTAP is a unit-testing framework for IBM Informix 14.10 and later. Write tests in SQL and SPL, run assertions inside the database, and use a lightweight Java runner to produce Test Anything Protocol (TAP) results and an exit status for CI pipelines.
What you get
- An SPL assertion library installed in your test database, including
tap_ok,tap_is,tap_throws_okand schema checks. - A JDBC command-line runner,
ifxtap, that executes a directory of test files and produces TAP version 13 output. - Transaction-based isolation: each test file runs within a transaction that is rolled back on completion, removing transactional fixture data and supported DDL changes.
- A non-zero exit code when an assertion fails, the test count differs from the plan, or a run does not complete.
What you can test
| Area | Examples |
|---|---|
| Values | Equality, inequality, NULL values, and LIKE and MATCHES patterns |
| Schema | Tables, views, indexes, triggers, routines, columns, data types, defaults and constraints |
| Behaviour | Stored procedures and functions, triggers activated by DML, and queries expected to return rows or no rows |
| Errors | Expected SQLCODE or ISAM error codes, and statements expected to execute successfully |
A test and its result
A test file is plain SQL. This one creates a function, calls it and checks what it returns. The runner wraps the file in a transaction and rolls it back, so nothing is left in the database.
EXECUTE PROCEDURE tap_plan(2);
CREATE FUNCTION add_interest(p_balance DECIMAL(10,2), p_pct INTEGER) RETURNING DECIMAL(10,2)
RETURN p_balance + (p_balance * p_pct / 100);
END FUNCTION;
CREATE TABLE result (v DECIMAL(10,2));
INSERT INTO result SELECT add_interest(200, 10) FROM sysmaster:sysdual;
EXECUTE PROCEDURE tap_has_function('add_interest');
EXECUTE PROCEDURE tap_is((SELECT v FROM result), 220.00, '10% on 200 is 220');
EXECUTE PROCEDURE tap_finish();
The runner prints Test Anything Protocol output and exits non-zero if anything failed:
1..2
ok 1 - function add_interest should exist
ok 2 - 10% on 200 is 220
More complete tests, for schemas, routines, triggers, constraints, hooks and your own SPL, are on the Examples page. Testing stored procedures and functions has its own guide: Testing Your Own SPL.
Works with your CI
Run ifxtap as a step in Jenkins, GitLab CI, GitHub Actions or any other pipeline: the exit status is 0 when
every assertion passes and non-zero when one fails, so a failed assertion fails the build. The output is TAP 13, and a run of
several files is one stream with a single plan, so a tool that reads TAP, such as prove, reads it as one run; see
Runner and TAP Output.
Requirements
- Informix 14.10 or later with a logged database.
- Java 11 or later on the machine running the tests.
- The IBM Informix JDBC driver, supplied separately.
Status: ifxTAP is pre-release. Questions, early access or a feature you need? Ask us about ifxTAP.