0

I got a gradle script that should run the testng xml files from command line. But whenever I try to run is with grald test I get the following output. With no test run even no browser opened

C:\Users\Steve\Documents\Projects\automation>gradle test
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE

BUILD SUCCESSFUL

My gradle script is the following

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'

group = 'automation'
version = '1.1-SNAPSHOT'

description = ""

repositories {

     maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
    compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:'2.52.0'
    compile group: 'org.uncommons', name: 'reportng', version:'1.1.4'
    compile group: 'org.apache.velocity', name: 'velocity', version:'1.7'
    compile group: 'com.google.inject', name: 'guice', version:'4.0'
    testCompile group: 'junit', name: 'junit', version:'3.8.1'
    testCompile group: 'org.testng', name: 'testng', version:'6.9.4'
}
test{
    useTestNG{

    include '/src/test/resources/BasicTestXML/**'}
}
stevedc
  • 483
  • 3
  • 8
  • 26

2 Answers2

0

include is used to include (or not) test classes: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html

What you are looking for is suites. See an example from the TestNG build file.

juherr
  • 5,640
  • 1
  • 21
  • 63
0

Found the solution how to run them and choose which to run

test{

    useTestNG() {
        suites "src/test/resources/BasicTestXML/LoginTest.xml"
    }
}

In this way you can choose which xml file it will run. If you want an extra to run just add an extra suites line.

stevedc
  • 483
  • 3
  • 8
  • 26