Package: org.gradle.api.tasks.testing.testng

## [Groovy] Class TestNGOptions

- org.gradle.api.tasks.testing.testng.TestNGOptions

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `DEFAULT_CONFIG_FAILURE_POLICY` |

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `static String` | `JAVADOC_ANNOTATIONS`
    `static String` | `JDK_ANNOTATIONS`
    `String` | `configFailurePolicy` Option for what to do for other tests that use a configuration step when that step fails.
    `Set<String>` | `excludeGroups` The set of groups to exclude.
    `Set<String>` | `includeGroups` The set of groups to run.
    `boolean` | `javadocAnnotations` When true, Javadoc annotations are used for these tests.
    `Set<String>` | `listeners` Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter).
    `File` | `outputDirectory` The location to write TestNG's output.
    `String` | `parallel` The parallel mode to use for running the tests - one of the following modes: methods, tests, classes or instances.
    `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.
    `groovy.xml.MarkupBuilder` | `suiteXmlBuilder`
    `List<File>` | `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

    Constructors
    Constructor and description
    `TestNGOptions (File projectDir)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `TestNGOptions` | `excludeGroups(String... excludeGroups)`
    `String` | `getAnnotations()`
    `protected File` | `getProjectDir()`
    `List<File>` | `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)`
    `groovy.xml.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)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final String DEFAULT_CONFIG_FAILURE_POLICY

  - ### Property Detail

    - #### static final String JAVADOC_ANNOTATIONS

    - #### static final String JDK_ANNOTATIONS

    - #### String configFailurePolicy

      Option for what to do for other tests that use a configuration step when that step fails. Can be "skip" or "continue", defaults to "skip".

    - #### Set<String> excludeGroups

      The set of groups to exclude.

    - #### Set<String> includeGroups

      The set of groups to run.

    - #### 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.

    - #### Set<String> 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'
             }
           }

    - #### @Incubating @OutputDirectory File outputDirectory

      The location to write TestNG's output.

      Defaults to the owning test task's location for writing the HTML report.

      Since:
        1.11

    - #### String parallel

      The parallel mode to use for running the tests - one of the following modes: methods, tests, classes or instances. Not required. If not present, parallel mode will not be selected

    - #### 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.

    - #### groovy.xml.MarkupBuilder suiteXmlBuilder

    - #### List<File> suiteXmlFiles

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

    - #### 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. Should be set if annotations is 'Javadoc'.

    - #### int threadCount

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

    - #### 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:
             reports.html.enabled = 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(File projectDir)

  - ### Method Detail

    - #### TestNGOptions excludeGroups(String... excludeGroups)

    - #### String getAnnotations()

    - #### protected File getProjectDir()

    - #### List<File> 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)

    - #### groovy.xml.MarkupBuilder suiteXmlBuilder()

    - #### void suites(String... suiteFiles)

      Add suite files by Strings. Each suiteFile String should be a path relative to the project root.

    - #### void suites(File... suiteFiles)

      Add suite files by File objects.

    - #### TestNGOptions useDefaultListeners()

    - #### TestNGOptions useDefaultListeners(boolean useDefaultListeners)