我有一个gradle脚本,应该从命令行运行testng xml文件。但是每当我尝试通过grald test运行时,都会得到以下输出。没有测试运行,甚至没有打开浏览器

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

我的gradle脚本如下
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/**'}
}

最佳答案

include用于包括(或不包括)测试类:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html

您正在寻找的是
suites
请参见the TestNG build file的示例。

10-06 11:22
查看更多