Welcome
db2unit is a testing framework for the SQL PL language.
CREATE OR REPLACE PROCEDURE ONE_TIME_SETUP()
... @
CREATE OR REPLACE PROCEDURE SETUP()
... @
CREATE OR REPLACE PROCEDURE TEAR_DOWN()
... @
CREATE OR REPLACE PROCEDURE ONE_TIME_TEAR_DOWN()
... @
Fixtures
Configure the environment with the fixtures.
CREATE OR REPLACE PROCEDURE TEST_MY_TEST()
BEGIN
DECLARE EXPECTED INTEGER;
DECLARE ACTUAL INTEGER;
CALL DB2UNIT.REGISTER_MESSAGE('My first test');
...
SET EXPECTED = 2;
SET ACTUAL = ...;
CALL DB2UNIT.ASSERT_INT_EQUALS('Same value', EXPECTED, ACTUAL);
END @
Suite name is the schema
Execute a test suite by calling RUN_SUITE and providing the
schema name.
db2 "CALL DB2UNIT.RUN_SUITE('DB2UNIT_EXAMPLE')"
...
Result set 2
--------------
TIME EXECUTION_ID STATUS MESSAGE
-------- ------------ --------------------- --------------------------------------------------------------
17:15:24 30405 Initialization db2unit is licensed under the terms of the GPL v3
17:15:24 30405 Initialization Execution of DB2UNIT_EXAMPLE with ID 30405
17:15:24 30405 Prepare Report The reports table created: DB2UNIT_EXAMPLE.REPORT_TESTS
17:15:30 30405 Calculating time Total execution time is: 5 seconds
4 record(s) selected.
Suite name is the schema
Execute a test suite by calling RUN_SUITE and providing the
schema name.
‹
›
Description
This is a testing framework for IBM DB2 written in SQL PL
language. It is
xUnit
framework, that takes the same design as the
well-known
jUnit.
The framework could be considered as a jUnit porting for
DB2 SQL-PL.
Resources
Usage and Idioms
Integration