You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split out of #753, which delivers the declarative setup, teardown, verification, and
configuration annotations. SQL script execution was deliberately left out of that scope
so it can be designed on its own.
Ask
Add annotations that run plain SQL script files around the dbUnit test lifecycle, at
class or method level, with method-level overriding class-level like the rest of the
annotation family:
a "before" hook that runs one or more .sql files ahead of dataset loading — the
usual use is schema DDL or a stored-procedure definition the dataset depends on
an "after" hook that runs one or more .sql files following teardown
Prior art in the community forks calls these @DbUnitInit, @SqlBefore, and @SqlAfter; naming should follow whatever the #753 family settles on.
Why it is not trivial
dbUnit has no SQL script execution capability at all today — there is no equivalent of
Spring's ScriptUtils or a SqlScriptExecutor anywhere in the codebase. This needs a
real implementation, not a wrapper, and the design has to decide:
statement splitting — a naive split on ; breaks on semicolons inside string
literals, comments, and BEGIN ... END blocks, which matters for the
stored-procedure case that motivates the feature
whether a failing statement aborts the script or is tolerated, and whether the script
runs in its own transaction
which connection the script runs on, and whether it participates in the
connection-reuse behaviour the rest of the lifecycle uses
Split out of #753, which delivers the declarative setup, teardown, verification, and
configuration annotations. SQL script execution was deliberately left out of that scope
so it can be designed on its own.
Ask
Add annotations that run plain SQL script files around the dbUnit test lifecycle, at
class or method level, with method-level overriding class-level like the rest of the
annotation family:
.sqlfiles ahead of dataset loading — theusual use is schema DDL or a stored-procedure definition the dataset depends on
.sqlfiles following teardownPrior art in the community forks calls these
@DbUnitInit,@SqlBefore, and@SqlAfter; naming should follow whatever the #753 family settles on.Why it is not trivial
dbUnit has no SQL script execution capability at all today — there is no equivalent of
Spring's
ScriptUtilsor aSqlScriptExecutoranywhere in the codebase. This needs areal implementation, not a wrapper, and the design has to decide:
;breaks on semicolons inside stringliterals, comments, and
BEGIN ... ENDblocks, which matters for thestored-procedure case that motivates the feature
runs in its own transaction
connection-reuse behaviour the rest of the lifecycle uses
Add dbUnit annotations for declarative test setup, verification, and configuration #753 annotations establish
Notes
Depends on #753 landing first, since it extends that annotation family and should share
its package, path-resolution convention, and precedence rules.