public abstract class TestNGOptions extends TestFrameworkOptions
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
DEFAULT_CONFIG_FAILURE_POLICY |
Constructor | Description |
---|---|
TestNGOptions(ProjectLayout projectLayout) |
Modifier and Type | Method | Description |
---|---|---|
void |
copyFrom(TestNGOptions other) |
Copies the options from the source options into the current one.
|
TestNGOptions |
excludeGroups(java.lang.String... excludeGroups) |
|
java.lang.String |
getConfigFailurePolicy() |
Option for what to do for other tests that use a configuration step when that step fails.
|
java.util.Set<java.lang.String> |
getExcludeGroups() |
The set of groups to exclude.
|
boolean |
getGroupByInstances() |
|
java.util.Set<java.lang.String> |
getIncludeGroups() |
The set of groups to run.
|
java.util.Set<java.lang.String> |
getListeners() |
Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter).
|
java.io.File |
getOutputDirectory() |
The location to write TestNG's output.
|
java.lang.String |
getParallel() |
The parallel mode to use for running the tests - one of the following modes: methods, tests, classes or instances.
|
boolean |
getPreserveOrder() |
|
protected java.io.File |
getProjectDir() |
|
java.lang.String |
getSuiteName() |
Sets the default name of the test suite, if one is not specified in a suite XML file or in the source code.
|
java.util.List<java.io.File> |
getSuites(java.io.File testSuitesDir) |
|
protected java.lang.String |
getSuiteXml() |
Returns the XML generated using
suiteXmlBuilder() , if any. |
MarkupBuilder |
getSuiteXmlBuilder() |
|
java.util.List<java.io.File> |
getSuiteXmlFiles() |
The suiteXmlFiles to use for running TestNG.
|
java.io.StringWriter |
getSuiteXmlWriter() |
|
java.lang.String |
getTestName() |
Sets the default name of the test, if one is not specified in a suite XML file or in the source code.
|
int |
getThreadCount() |
The number of threads to use for this run.
|
boolean |
getUseDefaultListeners() |
|
TestNGOptions |
includeGroups(java.lang.String... includeGroups) |
|
boolean |
isGroupByInstances() |
Indicates whether the tests should be grouped by instances.
|
boolean |
isPreserveOrder() |
Indicates whether the tests should be run in deterministic order.
|
boolean |
isUseDefaultListeners() |
Whether the default listeners and reporters should be used.
|
java.lang.Object |
methodMissing(java.lang.String name,
java.lang.Object args) |
|
java.lang.Object |
propertyMissing(java.lang.String name) |
|
void |
setConfigFailurePolicy(java.lang.String configFailurePolicy) |
|
void |
setExcludeGroups(java.util.Set<java.lang.String> excludeGroups) |
|
void |
setGroupByInstances(boolean groupByInstances) |
|
void |
setIncludeGroups(java.util.Set<java.lang.String> includeGroups) |
|
void |
setListeners(java.util.Set<java.lang.String> listeners) |
|
void |
setOutputDirectory(java.io.File outputDirectory) |
|
void |
setParallel(java.lang.String parallel) |
|
void |
setPreserveOrder(boolean preserveOrder) |
|
void |
setSuiteName(java.lang.String suiteName) |
|
void |
setSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder) |
|
void |
setSuiteXmlFiles(java.util.List<java.io.File> suiteXmlFiles) |
|
void |
setSuiteXmlWriter(java.io.StringWriter suiteXmlWriter) |
|
void |
setTestName(java.lang.String testName) |
|
void |
setThreadCount(int threadCount) |
|
void |
setUseDefaultListeners(boolean useDefaultListeners) |
|
void |
suites(java.io.File... suiteFiles) |
Add suite files by File objects.
|
void |
suites(java.lang.String... suiteFiles) |
Add suite files by Strings.
|
MarkupBuilder |
suiteXmlBuilder() |
|
TestNGOptions |
useDefaultListeners() |
|
TestNGOptions |
useDefaultListeners(boolean useDefaultListeners) |
public static final java.lang.String DEFAULT_CONFIG_FAILURE_POLICY
@Inject public TestNGOptions(ProjectLayout projectLayout)
public void copyFrom(TestNGOptions other)
public MarkupBuilder suiteXmlBuilder()
public void suites(java.lang.String... suiteFiles)
@Internal protected java.io.File getProjectDir()
public void suites(java.io.File... suiteFiles)
public java.util.List<java.io.File> getSuites(java.io.File testSuitesDir)
public TestNGOptions includeGroups(java.lang.String... includeGroups)
public TestNGOptions excludeGroups(java.lang.String... excludeGroups)
public TestNGOptions useDefaultListeners()
public TestNGOptions useDefaultListeners(boolean useDefaultListeners)
public java.lang.Object propertyMissing(java.lang.String name)
public java.lang.Object methodMissing(java.lang.String name, java.lang.Object args)
@OutputDirectory public java.io.File getOutputDirectory()
Defaults to the owning test task's location for writing the HTML report.
public void setOutputDirectory(java.io.File outputDirectory)
@Input public java.util.Set<java.lang.String> getIncludeGroups()
public void setIncludeGroups(java.util.Set<java.lang.String> includeGroups)
@Input public java.util.Set<java.lang.String> getExcludeGroups()
public void setExcludeGroups(java.util.Set<java.lang.String> excludeGroups)
@Internal public java.lang.String getConfigFailurePolicy()
public void setConfigFailurePolicy(java.lang.String configFailurePolicy)
@Internal public java.util.Set<java.lang.String> getListeners()
plugins { id 'java' } test { useTestNG() { // creates emailable HTML file // this reporter typically ships with TestNG library listeners << 'org.testng.reporters.EmailableReporter' } }
public void setListeners(java.util.Set<java.lang.String> listeners)
@Nullable @Internal public java.lang.String getParallel()
public void setParallel(java.lang.String parallel)
@Internal public int getThreadCount()
public void setThreadCount(int threadCount)
@Internal public boolean getUseDefaultListeners()
@Internal public boolean isUseDefaultListeners()
listeners
property. 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.
public void setUseDefaultListeners(boolean useDefaultListeners)
@Internal public java.lang.String getSuiteName()
public void setSuiteName(java.lang.String suiteName)
@Internal public java.lang.String getTestName()
public void setTestName(java.lang.String testName)
@InputFiles @PathSensitive(NONE) public java.util.List<java.io.File> getSuiteXmlFiles()
public void setSuiteXmlFiles(java.util.List<java.io.File> suiteXmlFiles)
@Internal public boolean getPreserveOrder()
@Internal public boolean isPreserveOrder()
public void setPreserveOrder(boolean preserveOrder)
@Internal public boolean getGroupByInstances()
@Internal public boolean isGroupByInstances()
public void setGroupByInstances(boolean groupByInstances)
@Input @Optional protected java.lang.String getSuiteXml()
suiteXmlBuilder()
, if any.
This property is read-only and exists merely for up-to-date checking.
@Internal public java.io.StringWriter getSuiteXmlWriter()
public void setSuiteXmlWriter(java.io.StringWriter suiteXmlWriter)
@Internal public MarkupBuilder getSuiteXmlBuilder()
public void setSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder)