Getting error "No Tests were found" & "Process finished with exit code -2"

Hi

I am newbie with Gradle and I am trying to write and run UI tests with Gradle. The following is the configuration –

Gradle Version : 7.5.1
Groovy : 3.0.10
JVM : 1.8.0_201
IDE : IntelliJ Community Edition 2022.2

I am trying to use JUnit4.

This is how I have setup the project –

And this is what I have in my build.gradle file.
plugins {
id ‘java’
id ‘groovy’
}

group ‘org.salespage’
version ‘1.0-SNAPSHOT’

repositories {
mavenCentral()
}

dependencies {
testImplementation ‘org.junit.vintage:junit-vintage-engine:5.9.0’
testRuntimeOnly ‘org.junit.vintage:junit-vintage-engine:5.9.0’
testCompileOnly ‘junit:junit:4.13’

implementation gradleApi()

testImplementation 'com.google.code.gson:gson:2.2.4@jar'
testImplementation 'org.apache.activemq:activemq-all:5.17.0'
testImplementation 'org.apache.httpcomponents:httpclient:4.5.13'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.9.0'
testImplementation 'org.apache.commons:commons-csv:1.9.0'
testImplementation 'org.hamcrest:hamcrest-core:2.2'

/* Geb specific implementation */
testImplementation 'org.gebish:geb-core:0.7.2'
testImplementation 'org.gebish:geb-junit4:6.0'
testImplementation 'org.gebish:geb-exceptions:6.0'
testImplementation 'org.gebish:geb-waiting:6.0'
testImplementation 'org.gebish:geb-ast:6.0'

/* Download drivers specific to the Browsers */
testImplementation 'org.seleniumhq.selenium:selenium-firefox-driver:2.42.2'
testImplementation 'org.seleniumhq.selenium:selenium-chrome-driver:2.42.2'
testImplementation 'org.seleniumhq.selenium:selenium-ie-driver:2.42.2'
testImplementation 'org.seleniumhq.selenium:selenium-edge-driver:2.47.1'

/* Download Selenium specific implementation */
testImplementation 'org.seleniumhq.selenium:selenium-api:4.6.0'
testImplementation 'org.seleniumhq.selenium:selenium-server:3.141.59'
testImplementation 'org.seleniumhq.selenium:selenium-remote-driver:4.6.0'
testImplementation 'org.seleniumhq.selenium:selenium-java:4.6.0'
testImplementation 'org.seleniumhq.selenium:selenium-support:2.42.2'
testImplementation 'org.seleniumhq.selenium:selenium-api:4.6.0'
testImplementation 'com.microsoft.sqlserver:mssql-jdbc:8.4.1.jre8'

}

test {
useJUnitPlatform()
}

So my question is how do I get Gradle to “find” my test? And is error code -2

Thanks.
–M

Is there any reason you don’t put the tests into src/test/groovy where they belong?
If yes, you can of course configure src/test/UITests as additional source directory for the test source set.

So, the src/test/groovy contains the test code, wherein I have written functions that would be called by the test. Let me try with what you have suggested.
Thank you for the reply.

1 Like