junit-team / junit5

✅ The 5th major version of the programmer-friendly testing framework for Java and the JVM

Home Page:https://junit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce mechanism to enable specific global extensions in JUnit Jupiter

translatenix opened this issue · comments

Enabling all global extensions on the class/module path with junit.jupiter.extensions.autodetection.enabled=true is asking for surprises (and potentially trouble).

Instead, I'd like to explicitly enable the global extensions that I want to use.

I imagine that I'd do this by setting junit.jupiter.extensions.autodetection.enabled=foo.bar.Baz,foo.bar.Qux or a similar property.

If the JUnit team is open to this idea, I'd be happy to discuss further and send a PR.

Thanks for the proposal, @translatenix.

We'll discuss it within the team during an upcoming team call and get back to you.

Team decision: Introduce junit.jupiter.extensions.autodetection.include and junit.jupiter.extensions.autodetection.exclude configuration parameters with defaults of * and empty, respectively.

Addendum: The new properties should support the same pattern matching syntax supported for other configuration parameters.

One use case would be to enable org.mockito.junit.jupiter.MockitoExtension from org.mockito:mockito-junit-jupiter globally by default. This would activate strict stubbing then. mockito/mockito#769.

Can I Contribute?

Hi @dev-jonghoonpark,

Can I Contribute?

Yes, feel free to submit a PR for review.

@marcphilipp

Team decision: Introduce junit.jupiter.extensions.autodetection.include and junit.jupiter.extensions.autodetection.exclude configuration parameters with defaults of * and empty, respectively.

It seems like junit.jupiter.extensions.autodetection.include and junit.jupiter.extensions.autodetection.exclude should be designed to accept more than one input, is that correct?

I think it should be able to accept multiple folders and multiple classes.

Yes, comma-separated entries with wildcard matching.