Has anyone successfully accessed the test-retry (o...
# plugin-development
k
Has anyone successfully accessed the test-retry (or develocity) plugin's Test task extension programmatically via a Java or Groovy binary plugin? I'm doing something like:
Copy code
project.tasks.register('myCustomTestTask', Test {

  TestRetryTaskExtension retry = it.extensions.getByType(TestRetryTaskExtension)
  ...
}
... but this throws o.g.a.UnknownDomainObjectException: Extension of type 'TestRetryTaskExtension' does not exist.
t
kotlin binary plugin but should get you there.
Copy code
target.tasks.named<Test>("test") {
            useJUnitPlatform()
            testLogging.showStandardStreams = true
            extensions.getByName<DevelocityTestConfiguration>("develocity").apply {
                testRetry {
                    maxRetries.set(1)
                    maxFailures.set(2)
                    failOnPassedAfterRetry.set(false)
                }
            }
        }
type is
com.gradle.develocity.agent.gradle.test.DevelocityTestConfiguration
might also be that its a custom test task? might need to make sure the develocity extension is on it.
k
Yeah seems like a chicken/egg problem related to being a custom task. Bring back
afterEvaluate
! (kidding)
😄 1
Maybe I need to wrap this in a closure which reacts to the develocity plugin...
t
worth a try at least
k
Hmmm
develocity
plugin in a Settings plugin; not sure how to react to whatever it's doing to manipulate Test tasks 🤔
t
yeah that was the thought I had. probably worth a zendesk ticket to ask them how to get it onto the custom test task
k
+1 I'll update here when/if I find out
🙏 1
Everything working as it should - problem was me