We have one requirement in multi gradle project, b...
# community-support
s
We have one requirement in multi gradle project, but i am sure whether we can achieve this or not, can someone help me? Assumption: • we have an interface with a list of methods to be implemented as a jar • Now i have a multi gradle project with buildSrc conventions to share the common dependencies such as above interface jar to be available for all sub gradle projects • Each sub project in the multi gradle prjoect is an implementation of the added interface. Requirement: • since we know all the subprojects are an implementation for our interface, we want to build a common test suite as a new subproject in multigradle project and use the same tests in all other sub projects, so we can avoid duplicating the same code again an again, is it possible, if yes, how to achieve this? • Even though the test suite is same the test data might differ, so i want to have seperate json file in each submodule project to use the respectiev json file for test result comparison/secret credentials for the test.
Gradle project structire roor -> buildSRC --> conventions.gradle --> build.gradle -> subproject1 --> build.gradle -> subproject2 --> build.gradle Each subproject has main and test folders
v
How about having the logic in that new project, and then in the other projects' tests call the test logic with the data as parameter? Or having the data in some file in a conventional place and from the test logic get it as resource from the class path?
s
we want to pass the test data as a parameter
v
Well, yeah, just do it 🙂
s
How can we create the testsuite sub project that can we used under another submodule? since the tests are residing in test package?
It would be very helpful if you can have any doc/sample project
v
As the productive purpose of that whole project is to provide code for tests, put the test code into its
main
source set, then just depend on it. If you don't like that, you could also use the Java test fixtures plugin.
🙌 1