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
Restore Previous Test Options Behavior #19080
Conversation
… accessed prior to test framework selection.
…s force test re-running.
…from a TestSuite even when that property is queried multiple times.
… and expect new deprecation warning to fix broken tests.
… in suites consistently.
@@ -1380,6 +1381,15 @@ private void validate(String output, String displayName) { | |||
} | |||
} | |||
|
|||
private boolean removeFirstExpectedDeprecationWarning(final Predicate<String> condition) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there was/is a reason for the remove all behavior - I think it just wasn't a problem since there was only 1 deprecation of any given type tested for at once. This change supports duplicates, where the same deprecation warning text appears multiple times within a single build. This is needed now with the new Options configuration warning added in this PR.
@@ -122,6 +122,7 @@ public class MyTest { | |||
|testing { | |||
| suites { | |||
| test { | |||
| useJUnit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to this test are to produce a much cleaner test buildScript, the previous one, captured from a breakpoint for each run in this test, had some misleading and irrelevant duplicated content.
@@ -45,7 +45,26 @@ class TestNGUpToDateCheckIntegrationTest extends AbstractIntegrationSpec { | |||
@Issue('https://github.com/gradle/gradle/issues/4924') | |||
def 'test task is up-to-date when #property is changed because it should not impact output'() { | |||
given: | |||
TestNGCoverage.enableTestNG(buildFile) | |||
buildScript """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More extraneous info in buildScript cleanup here.
@@ -472,8 +473,11 @@ class TestSuitesIntegrationTest extends AbstractIntegrationSpec { | |||
} | |||
""" | |||
|
|||
executer.expectDocumentedDeprecationWarning("Accessing test options prior to setting test framework has been deprecated. This is scheduled to be removed in Gradle 8.0.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of having twice the same deprecation warning printed?
@@ -592,4 +596,78 @@ class TestSuitesIntegrationTest extends AbstractIntegrationSpec { | |||
expect: | |||
succeeds("mytest", "assertNoTestClasses") | |||
} | |||
|
|||
def "multiple getTestingFramework() calls on a test suite return same instance"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could possibly delete these tests, but I like that we have something that will make the failure obvious if we ever revert by accident to the old behavior of new testingFramework instance per call.
|
||
package org.gradle; | ||
|
||
public interface CategoryB { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing from to Category A should work just as well as testing from Category A to Category B; but this would have sped the debugging a little so I think it's worth keeping a second category here.
@@ -944,13 +949,17 @@ public TestFramework testFramework(@Nullable Closure testFrameworkConfigure) { | |||
* | |||
* @return The test framework options. | |||
*/ | |||
@Internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an unnoticed regression - this needs to remain @Nested
here. For JUnit 4 alone - changing the Category
s included or excluded should force the Test
task to rerun and NOT result in an UP-TO-DATE
. This was only passing by accident.
…il everywhere without these assumptions.
…uccess/failure locally here, as on CI.
@bot-gradle test this |
OK, I've already triggered ReadyForMerge build for you. |
@@ -282,6 +282,152 @@ class TestTaskIntegrationTest extends JUnitMultiVersionIntegrationSpec { | |||
extraArgs << [[], ["--tests", "MyTest"]] | |||
} | |||
|
|||
def "options set prior to setting same test framework will warn and have no effect"() { | |||
ignoreWhenJUnitPlatform() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the need to run this class using the integMultiVersionTest
locally until it failed on CI. Need to ensure proper testing framework is being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with some nitpicky comments - thank you for the good comments/documentation in the Test task.
subprojects/plugins/src/main/java/org/gradle/api/plugins/jvm/internal/DefaultJvmTestSuite.java
Show resolved
Hide resolved
subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy
Show resolved
Hide resolved
subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy
Show resolved
Hide resolved
subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy
Show resolved
Hide resolved
subprojects/testing-jvm/src/integTest/groovy/org/gradle/testing/TestTaskIntegrationTest.groovy
Show resolved
Hide resolved
@bot-gradle test this |
OK, I've already triggered ReadyForMerge build for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release
as it should be part of 7.3.1.
Otherwise looks good overall. A few comments / questions below though:
@@ -472,8 +473,11 @@ class TestSuitesIntegrationTest extends AbstractIntegrationSpec { | |||
} | |||
""" | |||
|
|||
executer.expectDocumentedDeprecationWarning("Accessing test options prior to setting test framework has been deprecated. This is scheduled to be removed in Gradle 8.0.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of having twice the same deprecation warning printed?
subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java
Show resolved
Hide resolved
Migrating to a new PR here: #19087 and closing this issue. Will address comments there. |
Fixes #19058
Context
See review comments for more details on what this addresses.