Groovy Documentation

org.gradle.api.tasks.testing.testng
[Groovy] Class TestNGOptions

java.lang.Object
  org.gradle.api.tasks.testing.TestFrameworkOptions
      org.gradle.api.tasks.testing.testng.TestNGOptions
All Implemented Interfaces:
Serializable

class TestNGOptions
extends TestFrameworkOptions

Authors:
Tom Eyckmans


Property Summary
static String JAVADOC_ANNOTATIONS

static String JDK_ANNOTATIONS

Set excludeGroups

The set of groups to exclude.

Set includeGroups

The set of groups to run.

boolean javadocAnnotations

When true, Javadoc annotations are used for these tests.

Set listeners

Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter).

String parallel

The parallel mode to use for running the tests - either methods or tests.

String suiteName

Sets the default name of the test suite, if one is not specified in a suite xml file or in the source code.

MarkupBuilder suiteXmlBuilder

List suiteXmlFiles

The suiteXmlFiles to use for running TestNG.

StringWriter suiteXmlWriter

String testName

Sets the default name of the test, if one is not specified in a suite xml file or in the source code.

List testResources

List of all directories containing Test sources.

int threadCount

The number of threads to use for this run.

boolean useDefaultListeners

Whether the default listeners and reporters should be used.

 
Constructor Summary
TestNGOptions(File projectDir)

 
Method Summary
TestNGOptions excludeGroups(String... excludeGroups)

String getAnnotations()

List getSuites(File testSuitesDir)

TestNGOptions includeGroups(String... includeGroups)

TestNGOptions javadocAnnotations()

TestNGOptions jdkAnnotations()

Object methodMissing(String name, Object args)

Object propertyMissing(String name)

void setAnnotationsOnSourceCompatibility(JavaVersion sourceCompatibilityProp)

MarkupBuilder suiteXmlBuilder()

void suites(String... suiteFiles)

Add suite files by Strings.

void suites(File... suiteFiles)

Add suite files by File objects.

TestNGOptions useDefaultListeners()

TestNGOptions useDefaultListeners(boolean useDefaultListeners)

 

Property Detail

JAVADOC_ANNOTATIONS

static final String JAVADOC_ANNOTATIONS


JDK_ANNOTATIONS

static final String JDK_ANNOTATIONS


excludeGroups

Set excludeGroups
The set of groups to exclude.


includeGroups

Set includeGroups
The set of groups to run.


javadocAnnotations

boolean javadocAnnotations
When true, Javadoc annotations are used for these tests. When false, JDK annotations are used. If you use Javadoc annotations, you will also need to specify "sourcedir". Defaults to JDK annotations if you're using the JDK 5 jar and to Javadoc annotations if you're using the JDK 1.4 jar.


listeners

Set listeners
Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter). By default, the listeners set is empty. Configuring extra listener:
 apply plugin: 'java'

 test {
   useTestNG() {
     //creates emailable html file
     //this reporter typically ships with TestNG library
     listeners << 'org.testng.reporters.EmailableReporter'
   }
 }
 


parallel

String parallel
The parallel mode to use for running the tests - either methods or tests. Not required. If not present, parallel mode will not be selected


suiteName

String suiteName
Sets the default name of the test suite, if one is not specified in a suite xml file or in the source code.


suiteXmlBuilder

MarkupBuilder suiteXmlBuilder


suiteXmlFiles

List suiteXmlFiles
The suiteXmlFiles to use for running TestNG. Note: The suiteXmlFiles can be used in conjunction with the suiteXmlBuilder.


suiteXmlWriter

StringWriter suiteXmlWriter


testName

String testName
Sets the default name of the test, if one is not specified in a suite xml file or in the source code.


testResources

List testResources
List of all directories containing Test sources. Should be set if annotations is 'Javadoc'.


threadCount

int threadCount
The number of threads to use for this run. Ignored unless the parallel mode is also specified


useDefaultListeners

boolean useDefaultListeners
Whether the default listeners and reporters should be used. Since Gradle 1.4 it defaults to 'false' so that Gradle can own the reports generation and provide various improvements. This option might be useful for advanced TestNG users who prefer the reports generated by the TestNG library. If you cannot live without some specific TestNG reporter please use listeners property. If you really want to use all default TestNG reporters (e.g. generate the old reports):
 apply plugin: 'java'

 test {
   useTestNG() {
     //report generation delegated to TestNG library:
     useDefaultListeners = true
   }

   //turn off Gradle's HTML report to avoid replacing the
   //reports generated by TestNG library:
   testReport = false
 }
 
Please refer to the documentation of your version of TestNG what are the default listeners. At the moment of writing this documentation, the default listeners are a set of reporters that generate: TestNG variant of html results, TestNG variant of xml results in JUnit format, emailable html test report, xml results in TestNG format.


 
Constructor Detail

TestNGOptions

TestNGOptions(File projectDir)


 
Method Detail

excludeGroups

TestNGOptions excludeGroups(String... excludeGroups)


getAnnotations

String getAnnotations()


getSuites

List getSuites(File testSuitesDir)


includeGroups

TestNGOptions includeGroups(String... includeGroups)


javadocAnnotations

TestNGOptions javadocAnnotations()


jdkAnnotations

TestNGOptions jdkAnnotations()


methodMissing

Object methodMissing(String name, Object args)


propertyMissing

Object propertyMissing(String name)


setAnnotationsOnSourceCompatibility

void setAnnotationsOnSourceCompatibility(JavaVersion sourceCompatibilityProp)


suiteXmlBuilder

MarkupBuilder suiteXmlBuilder()


suites

void suites(String... suiteFiles)
Add suite files by Strings. Each suiteFile String should be a path relative to the project root.


suites

void suites(File... suiteFiles)
Add suite files by File objects.


useDefaultListeners

TestNGOptions useDefaultListeners()


useDefaultListeners

TestNGOptions useDefaultListeners(boolean useDefaultListeners)


 

Gradle API 1.4