Closed chitreshd closed 5 years ago
Hi,
the test tasks created by the plugin are just plain Gradle Test
tasks, which don't have such a feature.
in most cases I would recommend setting up and tearing down the test together with your test code. If you want to do it in Gradle, you should do so in separate tasks and wire the task dependencies accordingly.
Example:
tasks {
setupIntegrationTest {
// ... configure task to do whatever
}
tearDownIntegrationTest {
mustRunAfter integrationTest
// ... configure task to do whatever
}
setupIntegrationTest.finalizedBy tearDownIntegrationTest
integrationTest.dependsOn(setupIntegrationTest)
}
Sometimes this can be quite difficult to get right, especially if the teardown task has other task dependencies, or if some dynamic data generated by the setup task (e.g. a Docker container port) needs to be passed to the test.
that's a good suggestion. I am new to gradle, so let me try it. Thanks for your help.
Hi
We are using the plugin to describe integration tests in our gradle project.
Is there a way execute a setup ( example: IntegrationTest.setup() ) before running any test in
integration-test
and then cleanup ( example: IntegrationTest.cleanup() ) after running all tests.