Skip to content

Annotation-driven multi-data-source prep/expected verification #969

Description

@jeffjensen

Problem

#968 adds MultiDataSourcePrepAndExpectedTestCase, a programmatic API for prepping
and verifying multiple data sources in one test. The annotation path
(org.dbunit.annotation / DbUnitExtension, #753) has no equivalent — @DbUnitPrep
/ @DbUnitExpected and the tester resolution are single-data-source only, and
TesterResolver explicitly rejects more than one IDatabaseTester field as
ambiguous.

Proposal

Extend the annotation vocabulary and DbUnitExtension to drive
MultiDataSourcePrepAndExpectedTestCase (or an equivalent) declaratively:

  • a named-tester model — e.g. @DbUnitTester("orders"), or a qualifier member on the
    field markers — so more than one tester can be declared without ambiguity
  • per-data-source @DbUnitPrep / @DbUnitExpected (repeatable, keyed by data-source
    name)
  • TesterResolver / AnnotatedTestExecutor / ExpectedLifecycle / the resolvers
    updated to carry a keyed set of testers instead of exactly one, and the
    ParameterResolver for a keyed IDatabaseConnection / Connection

Scope note

Deliberately deferred from #968. It is a larger change touching TesterResolver,
AnnotatedTestExecutor, ExpectedLifecycle, and the parameter-injection model, and it
needs a named-connection design that does not exist yet. The @ParameterizedTest
limitation of annotations (see the DbUnit Annotations page's "When Not to Use These
Annotations") applies here too — the programmatic API from #968 remains the tool for
data that varies per invocation.

Dependencies

Depends on #968 and #753.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: annotationsdbUnit annotations for test configuration

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions