-
Notifications
You must be signed in to change notification settings - Fork 172
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
Do not run 'pollutedTests' task as a dependency of 'test' #1193
Comments
I've found https://junit-pioneer.org/, which has an extension to inject environment variables with an annotation. I run a test on the junit5 PR branch and both of the following options work 👍
In both cases we can remove the 'polluted' task configuration from Gradle, so Of the two options, I personally prefer the second, which adds some semantics to our discussions. We can refer to "polluted tests" and know exactly what it is. So I'd suggest proceeding with that as soon as JUnit5 is merged. |
Let's go with the second option then. |
Based on the article the anti-pattern is the use of On the topic of a different classpath I think we'd need to define a Gradle configuration and use that for the other test task. |
* Add junit-pioneer to inject environment variables into tests. This allows removing custom Gradle task pollutedTest and running them normally. * Refactor WhenAnAsciidoctorClassIsInstantiatedInAnEnvironmentWithGemPath as a parametrized tests. * Add missing cases for Asciidoctor Factory in WhenAnAsciidoctorClassIsInstantiatedInAnEnvironmentWithGemPath. Fixes asciidoctor#1193
* Add junit-pioneer to inject environment variables into tests. This allows removing custom Gradle task pollutedTest and running them normally. * Refactor WhenAnAsciidoctorClassIsInstantiatedInAnEnvironmentWithGemPath as a parametrized tests. * Add missing cases for Asciidoctor Factory in WhenAnAsciidoctorClassIsInstantiatedInAnEnvironmentWithGemPath. Fixes asciidoctor#1193
* Add junit-pioneer to inject environment variables into tests. This allows removing custom Gradle task pollutedTest and running them normally. * Refactor WhenAnAsciidoctorClassIsInstantiatedInAnEnvironmentWithGemPath as a parametrized tests. * Add missing cases for Asciidoctor Factory in WhenAnAsciidoctorClassIsInstantiatedInAnEnvironmentWithGemPath. Fixes asciidoctor#1193
pollutedTest
Gradle task is set as a dependency fortest
.That's on it's own a bat pattern (https://melix.github.io/blog/2021/10/gradle-quickie-dependson.html) but means there's no way to run tests without it.
Imo, we should look for an alternative to run the test without resorting to this pattern. Plus, this is especially an issue when running from IDE, since the polluted test will run always when trying to run a test class or method independently.
The text was updated successfully, but these errors were encountered: