public class TestNGOptions extends TestFrameworkOptions
Modifier and Type | Field | Description |
---|---|---|
static String |
DEFAULT_CONFIG_FAILURE_POLICY |
Constructor | Description |
---|---|
TestNGOptions(File projectDir) |
Modifier and Type | Method | Description |
---|---|---|
TestNGOptions |
excludeGroups(String... excludeGroups) |
|
String |
getConfigFailurePolicy() |
Option for what to do for other tests that use a configuration step when that step fails.
|
Set<String> |
getExcludeGroups() |
The set of groups to exclude.
|
boolean |
getGroupByInstances() |
|
Set<String> |
getIncludeGroups() |
The set of groups to run.
|
Set<String> |
getListeners() |
Fully qualified classes that are TestNG listeners (instances of org.testng.ITestListener or org.testng.IReporter).
|
File |
getOutputDirectory() |
The location to write TestNG's output.
|
String |
getParallel() |
The parallel mode to use for running the tests - one of the following modes: methods, tests, classes or instances.
|
boolean |
getPreserveOrder() |
|
protected File |
getProjectDir() |
|
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.
|
List<File> |
getSuites(File testSuitesDir) |
|
MarkupBuilder |
getSuiteXmlBuilder() |
|
List<File> |
getSuiteXmlFiles() |
The suiteXmlFiles to use for running TestNG.
|
StringWriter |
getSuiteXmlWriter() |
|
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(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.
|
Object |
methodMissing(String name,
Object args) |
|
Object |
propertyMissing(String name) |
|
void |
setConfigFailurePolicy(String configFailurePolicy) |
|
void |
setExcludeGroups(Set<String> excludeGroups) |
|
void |
setGroupByInstances(boolean groupByInstances) |
|
void |
setIncludeGroups(Set<String> includeGroups) |
|
void |
setListeners(Set<String> listeners) |
|
void |
setOutputDirectory(File outputDirectory) |
|
void |
setParallel(String parallel) |
|
void |
setPreserveOrder(boolean preserveOrder) |
|
void |
setSuiteName(String suiteName) |
|
void |
setSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder) |
|
void |
setSuiteXmlFiles(List<File> suiteXmlFiles) |
|
void |
setSuiteXmlWriter(StringWriter suiteXmlWriter) |
|
void |
setTestName(String testName) |
|
void |
setThreadCount(int threadCount) |
|
void |
setUseDefaultListeners(boolean useDefaultListeners) |
|
void |
suites(File... suiteFiles) |
Add suite files by File objects.
|
void |
suites(String... suiteFiles) |
Add suite files by Strings.
|
MarkupBuilder |
suiteXmlBuilder() |
|
TestNGOptions |
useDefaultListeners() |
|
TestNGOptions |
useDefaultListeners(boolean useDefaultListeners) |
public static final String DEFAULT_CONFIG_FAILURE_POLICY
public TestNGOptions(File projectDir)
public MarkupBuilder suiteXmlBuilder()
public void suites(String... suiteFiles)
protected File getProjectDir()
public void suites(File... suiteFiles)
public TestNGOptions includeGroups(String... includeGroups)
public TestNGOptions excludeGroups(String... excludeGroups)
public TestNGOptions useDefaultListeners()
public TestNGOptions useDefaultListeners(boolean useDefaultListeners)
@OutputDirectory public File getOutputDirectory()
Defaults to the owning test task's location for writing the HTML report.
public void setOutputDirectory(File outputDirectory)
public String getConfigFailurePolicy()
public void setConfigFailurePolicy(String configFailurePolicy)
public Set<String> getListeners()
apply plugin: 'java' test { useTestNG() { // creates emailable HTML file // this reporter typically ships with TestNG library listeners << 'org.testng.reporters.EmailableReporter' } }
@Nullable public String getParallel()
public void setParallel(String parallel)
public int getThreadCount()
public void setThreadCount(int threadCount)
public boolean getUseDefaultListeners()
public boolean isUseDefaultListeners()
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.
public void setUseDefaultListeners(boolean useDefaultListeners)
public String getSuiteName()
public void setSuiteName(String suiteName)
public String getTestName()
public void setTestName(String testName)
@InputFiles public List<File> getSuiteXmlFiles()
public boolean getPreserveOrder()
public boolean isPreserveOrder()
public void setPreserveOrder(boolean preserveOrder)
public boolean getGroupByInstances()
public boolean isGroupByInstances()
public void setGroupByInstances(boolean groupByInstances)
public StringWriter getSuiteXmlWriter()
public void setSuiteXmlWriter(StringWriter suiteXmlWriter)
public MarkupBuilder getSuiteXmlBuilder()
public void setSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder)