0

I am a newbee to gradle. The task at hand is to add a new gradle task that can run all the junits in the project and show a summary like which testcases passed, failed,skipped etc. gradle version used is 4.8.1 and junit4.11 The project structure is like this:

Myproject
|_____api
|      |_____src
|             |_____main
|             |_____test
|                     |____java
|_____cli
       |_____src
              |_____main
              |_____test
                      |____java

I am able to run the individual tests from intelliJ. There is a "test" method defined in the build.gradle of "cli" but I am not sure it runs. With command "gradle clean test" the build is successfull but I see no test results.

test {
    include '*/cli/src/test/java/testsuites/*'
    exclude '*/cli/src/test/java/com/myproject/mytool/*'
}

I have tried to add dependency and other things that I got from googling and at stackoverflow but of no use.Nothing seems to be working out.Can anyone help me to understand the basic steps and checks that I need to follow to create a gradle task for running junits? any help is appriciated.

user1731553
  • 1,887
  • 5
  • 22
  • 33
  • 1
    Does this answer your question? [aggregating gradle multiproject test results using TestReport](https://stackoverflow.com/questions/16921384/aggregating-gradle-multiproject-test-results-using-testreport) – thokuest Sep 14 '20 at 12:41
  • 1
    Your project structure indicates that you (should) have a multi-project build with two projects `api` and `cli`. Each project would then have its own task `test` that would expect the test classes under `src/test/java` (relatively to the respective project directory). If you just have a single project, Gradle may not find your (test) classes, because it expects them directly under `Myproject/src/test/java`. – Lukas Körfer Sep 14 '20 at 16:14

0 Answers0