What is a simple (but modern best-practices) way to configure Gradle so that it allows me to run integration tests similar to how a default Maven Failsafe configuration would work? I've read the Gradle docs for tests—in particular the Gradle docs for integration tests—but they seem pretty complicated (in comparison with Maven Failsafe), and moreover I don't believe the examples work in the same way.
What I'm looking for is pretty straightforward:
- There would be some separate task—let's call it
integrationTestfor the sake of discussion. - The
integrationTesttask would not run when I invokegradle test. - The
integrationTesttask would run (after thetesttask) when I invokegradle integrationTest. - The
integrationTesttask would run (after thetesttask) when I invokegradle check. - The
integrationTesttask would have identical dependencies and classpath configurations as thetesttask. - The
integrationTesttask would use the same source path (i.e.src/test/java) as thetesttask, but would only run tests ending in*IT(just to simplify the default Failsafe inclusion pattern for this discussion). - The
testtask would ignore all tests ending in*IT.
That's actually a pretty simple use case. (I just went into details so there would be no ambiguity.) I can turn that on in Failsafe using two lines to indicate goals, and three lines to indicate a dependency. Since Gradle takes the XML verbosity out of the equation, I should be able to configure that in two lines, right?
Just to be clear, I don't want to use Maven Failsafe in Gradle. I just want to configure Gradle to behave in a similar way as the default Failsafe configuration, as I detailed above.
https://stackoverflow.com/questions/66111459/simple-modern-gradle-configuration-to-mimic-default-maven-failsafe-configuration February 09, 2021 at 08:49AM
没有评论:
发表评论