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

Restore Previous Test Options Behavior #19080

Closed
wants to merge 9 commits into from

Conversation

tresat
Copy link
Member

@tresat tresat commented Nov 23, 2021

Fixes #19058

Context

See review comments for more details on what this addresses.

@tresat tresat requested a review from a team as a code owner November 23, 2021 00:10
@bot-gradle bot-gradle added this to the 7.4 RC1 milestone Nov 23, 2021
@tresat tresat self-assigned this Nov 23, 2021
@tresat tresat added @core Issue owned by GBT Core in:test-suites Work related to the JvmTestSuite Plugin labels Nov 23, 2021
@tresat tresat modified the milestones: 7.4 RC1, 7.3.1 Nov 23, 2021
@@ -1380,6 +1381,15 @@ private void validate(String output, String displayName) {
}
}

private boolean removeFirstExpectedDeprecationWarning(final Predicate<String> condition) {
Copy link
Member Author

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()
Copy link
Member Author

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 """
Copy link
Member Author

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.")
Copy link
Member Author

Choose a reason for hiding this comment

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

This is expected twice.

Copy link
Member

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"() {
Copy link
Member Author

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 {
Copy link
Member Author

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
Copy link
Member Author

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 Categorys included or excluded should force the Test task to rerun and NOT result in an UP-TO-DATE. This was only passing by accident.

@tresat tresat requested review from big-guy, DPUkyle and ljacomet and removed request for a team November 23, 2021 00:21
@gradle gradle deleted a comment from tresat Nov 23, 2021
@gradle gradle deleted a comment from tresat Nov 23, 2021
@tresat
Copy link
Member Author

tresat commented Nov 23, 2021

@bot-gradle test this

@gradle gradle deleted a comment from tresat Nov 23, 2021
@bot-gradle
Copy link
Collaborator

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()
Copy link
Member Author

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.

Copy link
Member

@DPUkyle DPUkyle left a 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.

@tresat
Copy link
Member Author

tresat commented Nov 23, 2021

@bot-gradle test this

@gradle gradle deleted a comment from tresat Nov 23, 2021
@bot-gradle
Copy link
Collaborator

OK, I've already triggered ReadyForMerge build for you.

Copy link
Member

@ljacomet ljacomet left a comment

Choose a reason for hiding this comment

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

⚠️ This needs to be done against 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.")
Copy link
Member

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?

@tresat
Copy link
Member Author

tresat commented Nov 23, 2021

Migrating to a new PR here: #19087 and closing this issue. Will address comments there.

@tresat tresat closed this Nov 23, 2021
@tresat tresat deleted the tt/74/restore-previous-test-options-behavior branch September 18, 2023 21:48
@ov7a ov7a removed this from the 7.3.1 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@core Issue owned by GBT Core in:test-suites Work related to the JvmTestSuite Plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider reverting breaking change about test configuration
5 participants