Gradle not finding tests to run

Viewed 342

I have a parent project "EqcareAutomationFramework" and a child project "EqcareDcbtTests". When I run tests as "Run as Gradle test", I am getting the following error but runs fine when i run as TestNg.

***Tests: com.eqcare.integration.tests.CloseSessionTest***

    > Task :EqcareAutomationFramework:compileJava UP-TO-DATE
    > Task :EqcareAutomationFramework:processResources NO-SOURCE
    > Task :EqcareAutomationFramework:classes UP-TO-DATE
    > Task :EqcareAutomationFramework:jar UP-TO-DATE
    > Task :compileJava NO-SOURCE
    > Task :processResources UP-TO-DATE
    > Task :classes UP-TO-DATE
    > Task :compileTestJava NO-SOURCE
    > Task :processTestResources UP-TO-DATE
    > Task :testClasses UP-TO-DATE
    > Task :runSuite NO-SOURCE
    > Task :test NO-SOURCE
    > Task :EqcareAutomationFramework:compileTestJava UP-TO-DATE
    > Task :EqcareAutomationFramework:processTestResources NO-SOURCE
    > Task :EqcareAutomationFramework:testClasses UP-TO-DATE
    > Task :EqcareAutomationFramework:test

FAILURE: Build failed with an exception.

* What went wrong:
No matching tests found in any candidate test task.
    Requested tests:
        Test class com.eqcare.integration.tests.CloseSessionTest

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 803ms
6 actionable tasks: 1 executed, 5 up-to-date

Following is the build.gradle file for parent Project "EqcareAutomationFramework"

> /*  * This file was generated by the Gradle 'init' task.  */  apply
> plugin: 'java'  apply plugin: 'eclipse'
> 
>  sourceSets {
>     main {
>         java {
>            srcDir './src'
>         }
>     } 
>     test {
>         java {
>            srcDirs = ["./src"]
>         }
>     }
>      }
> 
> repositories {        
>     mavenCentral()   }
> 
> dependencies {
>       implementation 'org.testng:testng:7.1.0'
>     implementation 'org.seleniumhq.selenium:selenium-server:3.141.59'
>     implementation 'log4j:log4j:1.2.17'
>     implementation 'org.apache.poi:poi:4.1.2'
>     implementation 'org.apache.httpcomponents:httpclient:4.5.13'
>     implementation 'commons-io:commons-io:2.8.0'
>     implementation 'activation:activation:1.0.2'
>     implementation 'javax.mail:mail:1.4.7'
>     implementation 'com.aventstack:extentreports:3.1.5'
>     implementation 'io.appium:java-client:7.4.1'
>     implementation 'com.android.tools.build:gradle:2.3.0' 
>     implementation 'software.amazon.awssdk:aws-sdk-java:2.15.32' 
>     implementation 'jfree:jfreechart:1.0.13' }
> 
> test{     
       useTestNG() 
      }

Following is the build.gradle file for child Project "EqcareDcbtTests"

apply plugin: 'java'


sourceSets {    
           main {           
               resources.srcDirs = ['clinic', 'patient',
 'integration', 'commonUtils']      
             }  
            test{           
              resources.srcDirs =['clinic', 'patient', 
                  'integration','commonUtils']      
                } 
    }
dependencies {  
           implementation project(':EqcareAutomationFramework') 
   }
project repositories {
    mavenCentral() 
   }
 task runSuite (type: Test) {   
     test.testLogging.showStandardStreams = true    
     useTestNG() {
         suites 'testsuite/'+ System.getProperty('suiteName')
    } }

Folder Structure for Parent Project: EqcareAutomationFramework

Folder Structure for Child Project: EqcareDcbtProject

1 Answers

You are trying to run a class that has no tests. You are trying to execute CloseSessionTest which seems not to be a test class.

Related