Skip to content

[Junit5 extension] Add Interception of @ParameterizedTest to JUnit Open Feature Extension #1091

Closed
@sebastian-zahrhuber

Description

@sebastian-zahrhuber

If the JUnit Open Feature Extension is used, a developer needs to use the @Flag annotation on @Test and @ParameterizedTest methods.

By intercepting the test method, the OpenFeatureExtension sets the current namespace for the TestProvider which is used later on in the evaluation. This is done by implementing the interface InvocationInterceptor and overriding the method interceptTestMethod.
Actually, the method interceptTestMethod does not intercept methods annotated with @ParameterizedTest. This leads to the issue that during the feature flag evaluation, the current namespace is not set int the TestProvider and therefore, the flag values cannot be stubbed with the annotation @Flag.
To fix the issue not only the method interceptTestMethod must be overridden, but InvocationInterceptor.interceptTestTemplateMethod() must be overridden as well.

A/C

@Flag annotation mocks feature flags on test methods annotated with @test and @ParameterizedTest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions