Class TestNGOptions
java.lang.Object
org.gradle.api.tasks.testing.TestFrameworkOptions
org.gradle.api.tasks.testing.testng.TestNGOptions
The TestNG specific test options.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcopyFrom(TestNGOptions other) Copies the options from the source options into the current one.excludeGroups(String... excludeGroups) Option for what to do for other tests that use a configuration step when that step fails.The set of groups to exclude.booleanThe set of groups to run.Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter).The location to write TestNG's output.The parallel mode to use for running the tests - one of the following modes: methods, tests, classes or instances.booleanprotected FileSets the default name of the test suite, if one is not specified in a suite XML file or in the source code.The number of XML suites will run parallelprotected StringReturns the XML generated usingsuiteXmlBuilder(), if any.The suiteXmlFiles to use for running TestNG.Sets the default name of the test, if one is not specified in a suite XML file or in the source code.intThe number of threads to use for this run.ThreadPoolExecutorFactory class used by TestNGbooleanincludeGroups(String... includeGroups) booleanIndicates whether the tests should be grouped by instances.booleanIndicates whether the tests should be run in deterministic order.booleanWhether the default listeners and reporters should be used.methodMissing(String name, Object args) propertyMissing(String name) voidsetConfigFailurePolicy(String configFailurePolicy) voidsetExcludeGroups(Set<String> excludeGroups) voidsetGroupByInstances(boolean groupByInstances) voidsetIncludeGroups(Set<String> includeGroups) voidsetListeners(Set<String> listeners) voidsetOutputDirectory(File outputDirectory) voidsetParallel(String parallel) voidsetPreserveOrder(boolean preserveOrder) voidsetSuiteName(String suiteName) voidsetSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder) voidsetSuiteXmlFiles(List<File> suiteXmlFiles) voidsetSuiteXmlWriter(StringWriter suiteXmlWriter) voidsetTestName(String testName) voidsetThreadCount(int threadCount) voidsetThreadPoolFactoryClass(String threadPoolFactoryClass) Sets a custom threadPoolExecutorFactory class.voidsetUseDefaultListeners(boolean useDefaultListeners) voidAdd suite files by File objects.voidAdd suite files by Strings.useDefaultListeners(boolean useDefaultListeners) 
- 
Field Details- 
DEFAULT_CONFIG_FAILURE_POLICY- See Also:
 
 
- 
- 
Constructor Details- 
TestNGOptions
 
- 
- 
Method Details- 
copyFromCopies the options from the source options into the current one.- Since:
- 8.0
 
- 
suiteXmlBuilder
- 
suitesAdd suite files by Strings. Each suiteFile String should be a path relative to the project root.
- 
getProjectDir
- 
suitesAdd suite files by File objects.
- 
getSuites
- 
includeGroups
- 
excludeGroups
- 
useDefaultListeners
- 
useDefaultListeners
- 
propertyMissing
- 
methodMissing
- 
getOutputDirectoryThe location to write TestNG's output.Defaults to the owning test task's location for writing the HTML report. - Since:
- 1.11
 
- 
setOutputDirectory
- 
getIncludeGroupsThe set of groups to run.
- 
setIncludeGroups
- 
getExcludeGroupsThe set of groups to exclude.
- 
setExcludeGroups
- 
getConfigFailurePolicyOption for what to do for other tests that use a configuration step when that step fails. Can be "skip" or "continue", defaults to "skip".
- 
setConfigFailurePolicy
- 
getListenersFully 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:plugins { id 'java' } test { useTestNG() { // creates emailable HTML file // this reporter typically ships with TestNG library listeners << 'org.testng.reporters.EmailableReporter' } }
- 
setListeners
- 
getParallelThe 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
- 
setParallel
- 
getThreadCountThe number of threads to use for this run. Ignored unless the parallel mode is also specified
- 
setThreadCountpublic void setThreadCount(int threadCount) 
- 
getSuiteThreadPoolSizeThe number of XML suites will run parallel- Since:
- 8.9
 
- 
getUseDefaultListeners
- 
getThreadPoolFactoryClassThreadPoolExecutorFactory class used by TestNG- Since:
- 8.7
 
- 
isUseDefaultListenersWhether 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 uselistenersproperty. If you really want to use all default TestNG reporters (e.g. generate the old reports):plugins { id '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.required = 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.
- 
setUseDefaultListenerspublic void setUseDefaultListeners(boolean useDefaultListeners) 
- 
setThreadPoolFactoryClassSets a custom threadPoolExecutorFactory class. This should be a fully qualified class name and the class should implement org.testng.IExecutorFactory More details in https://github.com/testng-team/testng/pull/2042 Requires TestNG 7.0 or higher- Since:
- 8.7
 
- 
getSuiteNameSets the default name of the test suite, if one is not specified in a suite XML file or in the source code.
- 
setSuiteName
- 
getTestNameSets the default name of the test, if one is not specified in a suite XML file or in the source code.
- 
setTestName
- 
getSuiteXmlFilesThe suiteXmlFiles to use for running TestNG. Note: The suiteXmlFiles can be used in conjunction with the suiteXmlBuilder.
- 
setSuiteXmlFiles
- 
getPreserveOrder
- 
isPreserveOrderIndicates whether the tests should be run in deterministic order. Preserving the order guarantees that the complete test (including @BeforeXXX and @AfterXXX) is run in a test thread before the next test is run. Not required. If not present, the order will not be preserved.
- 
setPreserveOrderpublic void setPreserveOrder(boolean preserveOrder) 
- 
getGroupByInstances
- 
isGroupByInstancesIndicates whether the tests should be grouped by instances. Grouping by instances will result in resolving test method dependencies for each instance instead of running the dependees of all instances before running the dependants. Not required. If not present, the tests will not be grouped by instances.
- 
setGroupByInstancespublic void setGroupByInstances(boolean groupByInstances) 
- 
getSuiteXmlReturns the XML generated usingsuiteXmlBuilder(), if any.This property is read-only and exists merely for up-to-date checking. 
- 
getSuiteXmlWriter
- 
setSuiteXmlWriter
- 
getSuiteXmlBuilder
- 
setSuiteXmlBuilder
 
-