Home:ALL Converter>gradle integrationTest and testFixtures

gradle integrationTest and testFixtures

Ask Time:2022-05-17T04:07:18         Author:Gavriel

Json Formatter

I'm using gradle 7.4.2 so I decided to split the tests to proper unit-test and integration-tests. I moved one class from src/test/java/com/example to src/integrationTest/java/com/example, and started to add the missing dependencies.

The problem is that I couldn't find how to use the testFixtures of :project-with-fixture . Is there a way to do that in integrationTest?

I had the following dependencies:

testImplementation project(':other-project')
testImplementation project(':project-with-fixture')
testImplementation testFixtures(project(':project-with-fixture'))
testImplementation project(':common')
testImplementation "com.google.guava:guava:${com_google_guava_version}"

And here's the new part of the build.gradle:

testing {
    suites {
        integrationTest(JvmTestSuite) {
            dependencies {
                implementation project
                implementation project(':other-project')
                implementation project(':project-with-fixture')
//                testImplementation testFixtures(project(':project-with-fixture'))
                implementation project(':common')
                implementation "com.google.guava:guava:${com_google_guava_version}"
            }

            targets {
                all {
                    testTask.configure {
                        shouldRunAfter(test)
                    }
                }
            }
        }
    }
}
tasks.named('check') {
    dependsOn testing.suites.integrationTest
}

Author:Gavriel,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72265012/gradle-integrationtest-and-testfixtures
yy