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

Accessing test options no longer warns, but locks in test framework selection #21750

Closed
wants to merge 19 commits into from

Conversation

tresat
Copy link
Member

@tresat tresat commented Aug 30, 2022

Fixes #21747

This undoes #19058 for Gradle 8.0.

@tresat tresat added this to the 8.0 RC1 milestone Aug 30, 2022
@tresat tresat self-assigned this Aug 30, 2022
@tresat tresat requested a review from a team August 31, 2022 14:55
@tresat tresat marked this pull request as ready for review August 31, 2022 14:55
@tresat tresat requested a review from a team as a code owner August 31, 2022 14:55
@tresat tresat removed the request for review from a team August 31, 2022 14:55
@gradle gradle deleted a comment from tresat Aug 31, 2022
@tresat
Copy link
Member Author

tresat commented Sep 12, 2022

This comment here seems related: https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java#L152-L155

Nice catch. Yes, I'll remove that map for a (very minor) optimization.

…amework after options are already set

- Also provide each test framework with a display name property for user-facing references.
@gradle gradle deleted a comment from tresat Sep 12, 2022
@gradle gradle deleted a comment from tresat Sep 12, 2022
- Add comment explaining why.
- Add tests to ensure behavior remains correct.
@gradle gradle deleted a comment from tresat Sep 13, 2022
@gradle gradle deleted a comment from tresat Sep 13, 2022
…accessed; check this when changing framework in a suite

- We need to check not just when changing the test framework within a test task, but when changing the test framework for a suite
if the associated test tasks for that suite have had options accessed.  Otherwise, the test task will silently continue to use the options
and framework first configured without switching to the new ones.
- Create new test class to demonstrate misconfigurations of options.
@gradle gradle deleted a comment from tresat Sep 13, 2022
@gradle gradle deleted a comment from tresat Sep 14, 2022
@tresat
Copy link
Member Author

tresat commented Sep 14, 2022

I think I’ve now covered all the cases where you could cause issues by changing the test framework after setting options. This ended up being a little more complex than we had anticipated.

Copy link
Member

@jvandort jvandort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on adding all the new tests. Mostly just nitpicks here and there but LGTM

- Remove margin bar in multiline strings.
- Make naming of migrated method consistent.
- Remove extraneous comments.
…ite in error message if attempt fails due to test options already being accessed
@gradle gradle deleted a comment from tresat Sep 14, 2022
@tresat
Copy link
Member Author

tresat commented Sep 14, 2022

@bot-gradle test this

@gradle gradle deleted a comment from tresat Sep 14, 2022
@bot-gradle
Copy link
Collaborator

OK, I've already triggered the following builds for you:

@marcphilipp marcphilipp removed their request for review September 16, 2022 09:39
# Conflicts:
#	subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java
#	subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/TestFramework.java
#	subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junit/JUnitTestFramework.java
#	subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/junitplatform/JUnitPlatformTestFramework.java
#	subprojects/testing-jvm/src/main/java/org/gradle/api/internal/tasks/testing/testng/TestNGTestFramework.java
@tresat
Copy link
Member Author

tresat commented Sep 16, 2022

@bot-gradle test this

@gradle gradle deleted a comment from tresat Sep 16, 2022
@bot-gradle
Copy link
Collaborator

OK, I've already triggered the following builds for you:

@tresat tresat closed this Oct 11, 2022
@tresat tresat deleted the tt/80/deprecations/use-test-framework branch September 18, 2023 21:51
@ov7a ov7a removed this from the 8.0 RC1 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Test.useTestFramework to throw error upon improper usage
6 participants