Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

junit.jupiter.conditions.deactivate is not behaving as expected. #3828

Closed
1 task
dev-jonghoonpark opened this issue May 22, 2024 · 1 comment
Closed
1 task

Comments

@dev-jonghoonpark
Copy link

When using junit.jupiter.conditions.deactivate, it is not behaving as expected.

Pattern Matching Syntax


The path to the test file is as follows

  • /src/test/java/org/example/DisableTest.java
    (This test file has one normal test and one disabled test.)

Depending on the value of junit.jupiter.conditions.deactivate, I got the following results.

  • case 1 : *
    • expected : tests passed: 2
    • actual : tests passed: 2
  • case 2 : org.*
    • expected : tests passed: 2
    • actual : tests passed: 2
  • case 3 : org.example.*
    • expected : tests passed: 2
    • actual : tests passed: 1, ignored: 1
  • case 4 : org.example.DisableTest
    • expected : tests passed: 2
    • actual : tests passed: 1, ignored: 1

Am I misunderstanding the usage?
If it is a bug, can I try to fix it?
I think the ClassNamePatternFilterUtils needs fixing.

Steps to reproduce

https://github.com/dev-jonghoonpark/junit5-example-class-name-pattern-filter-utils

I've created a systemProperty in gradle for each case.
You can uncomment each case to test it.

Context

  • Used versions (Jupiter/Vintage/Platform): 5.10.2
  • Build Tool/IDE: IntelliJ IDEA 2023.3.4 (Ultimate Edition)

Deliverables

  • Fix ClassNamePatternFilterUtils to work as expected
@sbrannen
Copy link
Member

Am I misunderstanding the usage?

Yes.

The junit.jupiter.conditions.deactivate configuration parameter is used to deactivate ExecutionConditions such as the the DisabledCondition that is built into JUnit Jupiter (org.junit.jupiter.engine.extension.DisabledCondition).

That configuration parameter is not used to filter out test classes or test methods.

When you set it to * or org.*, those patterns match org.junit.jupiter.engine.extension.DisabledCondition and therefore deactivate @Disabled, which allows both of the test methods in your class to run.

Thus, the behavior you have described is to be expected.

In order to filter tests within your Gradle build, you will need to use the Test Filtering support provided by Gradle.

In light of the above, I am closing this issue.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants