I have a separate task to run the test that generates open-api.yml
specification for my application. Here is the Gradle configuration below:
task generateOpenApiYml(type: Test) {
group = 'verification'
useJUnitPlatform {
includeTags 'openApi'
}
testLogging {
showExceptions true
showStandardStreams = false
showCauses true
showStackTraces true
exceptionFormat "full"
events("skipped", "failed", "passed")
}
}
So, I have one test with openApi
JUnit tag. It works very well, but there is a slight thing I want to approve.
The whole idea of this test is that the result open-api.yml
file is used to generate Java client to invoke REST endpoints. This client is used in other tests in the project.
I want to put those generated Java classes to .gitgnore
because they are generated anyway and there is no need to index those files. The problem is that the generateOpenApiYml
task compiles all the tests in src/test/java
directory. Therefore, some of them use generated classes. Which leads to compiling errors.
Is it possible to tune the generateOpenApiYml
task to make it compile and run only the single test with openApi
JUnit tag? Then I could easily put generated Java classes to .gitignore
and don't bother about their temporary absence, because other tests won't be compiled.