Default is {@code true}
*/ public TestNgOperation alwaysRunListeners(Boolean isAlwaysRunListeners) { options.put("-alwaysrunlisteners", String.valueOf(isAlwaysRunListeners)); return this; } /** * This sets the default maximum number of threads to use for data providers when running tests in parallel. * It will only take effect if the parallel mode has been selected (for example,with the * {@link #parallel(Parallel) parallel} option). This can be overridden in the suite definition. */ public TestNgOperation dataProviderThreadCount(int count) { options.put("-dataproviderthreadcount", String.valueOf(count)); return this; } /** * The dependency injector factory implementation that TestNG should use. */ public TestNgOperation dependencyInjectorFactory(String injectorFactory) { options.put("-dependencyinjectorfactory", injectorFactory); return this; } /** * The directory where the reports will be generated * *Default is {@code build/test-output})
*/ public TestNgOperation directory(String directoryPath) { options.put("-d", directoryPath); return this; } /** * The list of groups you want to be excluded from this run. * * @see #excludeGroups(Collection) */ public TestNgOperation excludeGroups(String... group) { options.put("-excludegroups", String.join(",", group)); return this; } /** * The list of groups you want to be excluded from this run. * * @see #excludeGroups(String...) */ public TestNgOperation excludeGroups(CollectionDefault is {@code false}
. */ public TestNgOperation generateResultsPerSuite(Boolean resultsPerSuite) { options.put("-generateResultsPerSuite", String.valueOf(resultsPerSuite)); return this; } /** * The list of groups you want to run. * *For example: {@code "windows", "linux", "regression}
* * @see #groups(Collection) */ public TestNgOperation groups(String... group) { options.put("-groups", String.join(",", group)); return this; } /** * The list of groups you want to run. * *For example: {@code "windows", "linux", "regression}
* * @see #groups(String...) */ public TestNgOperation groups(CollectionDefault is {@code false}
*/ public TestNgOperation ignoreMissedTestName(Boolean isIgnoreMissedTestNames) { options.put("-ignoreMissedTestNames", String.valueOf(isIgnoreMissedTestNames)); return this; } /** * Should TestNG report all iterations of a data driven test as individual skips, in-case of upstream failures. * *Default is {@code false}
*/ public TestNgOperation includeAllDataDrivenTestsWhenSkipping(Boolean isIncludeDrivenTestsWhenSkipping) { options.put("-includeAllDataDrivenTestsWhenSkipping", String.valueOf(isIncludeDrivenTestsWhenSkipping)); return this; } /** * Enables or disables the JUnit mode. * *Default is {@code false}
*/ public TestNgOperation jUnit(Boolean isJunit) { options.put("-junit", String.valueOf(isJunit)); return this; } /** * The list of {@code .class} files or list of class names implementing {@code ITestListener} or * {@code ISuiteListener} * * @see #listener(Collection) */ public TestNgOperation listener(String... listener) { options.put("-listener", String.join(",", listener)); return this; } /** * The list of {@code .class} files or list of class names implementing {@code ITestListener} or * {@code ISuiteListener} * * @see #listener(String...) */ public TestNgOperation listener(CollectionFor example: {@code "com.example.Selector1:3", "com.example.Selector2:2"}
* * @see #methodSelectors(Collection) */ public TestNgOperation methodSelectors(String... selector) { options.put("-methodselectors", String.join(",", selector)); return this; } /** * Specifies the list of {@code .class} files or class names implementing {@code IMethodSelector}. * *For example: {@code "com.example.Selector1:3", "com.example.Selector2:2"}
* * @see #methodSelectors(String...) */ public TestNgOperation methodSelectors(CollectionFor example: {@code "com.example.Foo.f1", "com.example.Bar.f2"}
* * @see #methods(Collection) */ public TestNgOperation methods(String... method) { options.put("-methods", String.join(",", method)); return this; } /** * Lets you specify individual methods to run. * *For example: {@code "com.example.Foo.f1", "com.example.Bar.f2"}
* * @see #methods(String...) */ public TestNgOperation methods(CollectionDefault is {@code false}
*/ public TestNgOperation mixed(Boolean isMixed) { options.put("-mixed", String.valueOf(isMixed)); return this; } /** * The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}. * * @see #objectFactory(Collection) */ public TestNgOperation objectFactory(String... factory) { options.put("-objectfactory", String.join(",", factory)); return this; } /** * The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}. * * @see #objectFactory(String...) */ public TestNgOperation objectFactory(CollectionFor example: {@code "com.example", "test.sample.*"}
* * @see #packages(Collection) */ public TestNgOperation packages(String... name) { packages.addAll(Arrays.stream(name).toList()); return this; } /** * The list of packages to include in this test. * If the package name ends with .* then subpackages are included too. * Required if no {@link #suites(String... suites)} specified. * *For example: {@code "com.example", "test.sample.*"}
* * @see #packages(String...) */ public TestNgOperation packages(CollectionDefault is {@code false}
*/ public TestNgOperation propagateDataProviderFailureAsTestFailure(Boolean isPropagateDataProviderFailure) { options.put("-propagateDataProviderFailureAsTestFailure", String.valueOf(isPropagateDataProviderFailure)); return this; } /** * Specifies the extended configuration for custom report listener. */ public TestNgOperation reporter(String reporter) { options.put("-reporter", reporter); return this; } /** * The directories where your javadoc annotated test sources are. This option is only necessary * if you are using javadoc type annotations. (e.g. {@code "src/test"} or * {@code "src/test/org/testng/eclipse-plugin", "src/test/org/testng/testng"}). * * @see #sourceDir(String...) */ public TestNgOperation sourceDir(String... directory) { options.put("-sourcedir", String.join(";", directory)); return this; } /** * The directories where your javadoc annotated test sources are. This option is only necessary * if you are using javadoc type annotations. (e.g. {@code "src/test"} or * {@code "src/test/org/testng/eclipse-plugin", "src/test/org/testng/testng"}). * * @see #sourceDir(String...) */ public TestNgOperation sourceDir(CollectionFor example: {@code "testng.xml", "testng2.xml"}
* * @see #suites(Collection) */ public TestNgOperation suites(String... suite) { suites.addAll(Arrays.stream(suite).toList()); return this; } /** * Specifies the suites to run. * *For example: {@code "testng.xml", "testng2.xml"}
* * @see #suites(String...) */ public TestNgOperation suites(CollectionFor example: {@code "org.foo.Test1","org.foo.test2"}
* * @see #testClass(Collection) */ public TestNgOperation testClass(String... aClass) { options.put("-testclass", String.join(",", aClass)); return this; } /** * Specifies the list of class files. * *For example: {@code "org.foo.Test1","org.foo.test2"}
* * @see #testClass(String...) */ public TestNgOperation testClass(CollectionDefault is {@code true}
*/ public TestNgOperation useDefaultListeners(Boolean isDefaultListener) { options.put("-usedefaultlisteners", String.valueOf(isDefaultListener)); return this; } /** * Set the Level of verbosity. * * @see #log(int) */ public TestNgOperation verbose(int level) { options.put("-verbose", String.valueOf(level)); return this; } private File writeDefaultSuite() throws IOException { var temp = tempFile(); try (var bufWriter = Files.newBufferedWriter(Paths.get(temp.getPath()))) { bufWriter.write("" + "" + "