Compare commits
3 commits
b69faf34d6
...
dd196cd761
Author | SHA1 | Date | |
---|---|---|---|
dd196cd761 | |||
100ce6dc0d | |||
f92ab27463 |
8 changed files with 292 additions and 53 deletions
2
.idea/copyright/Apache_License.xml
generated
2
.idea/copyright/Apache_License.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value=" Copyright &#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||
<option name="notice" value="Copyright &#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||
<option name="myName" value="Apache License" />
|
||||
</copyright>
|
||||
</component>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<pattern value="rife.bld.extension.TestNgOperationBuild" method="pmd" />
|
||||
|
@ -9,6 +10,7 @@
|
|||
<option name="customRuleSets">
|
||||
<list>
|
||||
<option value="K:\java\semver\config\pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="skipTestSources" value="false" />
|
||||
|
|
|
@ -38,15 +38,18 @@ public void test throws Exception {
|
|||
.execute();
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
./bld compile test
|
||||
```
|
||||
|
||||
- [View Examples](https://github.com/rife2/bld-tetng/tree/master/examples]
|
||||
|
||||
Please check the [TestNgOperation documentation](https://rife2.github.io/bld-testng/rife/bld/extension/TestNgOperation.html#method-summary) for all available configuration options.
|
||||
|
||||
### TestNG Dependency
|
||||
|
||||
Don't forget to add a TestNG test dependency to your build file, as it is not provided by the extension. For example:
|
||||
Don't forget to add a TestNG `test` dependency to your build file, as it is not provided by the extension. For example:
|
||||
|
||||
```java
|
||||
repositories = List.of(MAVEN_CENTRAL);
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
@ -98,12 +98,24 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
|
||||
/**
|
||||
* 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(Collection<String> group) {
|
||||
options.put("-excludegroups", String.join(",", group));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Part of the {@link #execute execute} operation, constructs the command list to use for building the process.
|
||||
*/
|
||||
|
@ -119,7 +131,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
options.put("d", Path.of(project.buildDirectory().getPath(), "test-output").toString());
|
||||
}
|
||||
|
||||
List<String> args = new ArrayList<>();
|
||||
final List<String> args = new ArrayList<>();
|
||||
args.add(javaTool());
|
||||
|
||||
args.add("-cp");
|
||||
|
@ -197,12 +209,26 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
* The list of groups you want to run.
|
||||
*
|
||||
* <p>For example: {@code "windows", "linux", "regression}</p>
|
||||
*
|
||||
* @see #groups(Collection)
|
||||
*/
|
||||
public TestNgOperation groups(String... group) {
|
||||
options.put("-groups", String.join(",", group));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of groups you want to run.
|
||||
*
|
||||
* <p>For example: {@code "windows", "linux", "regression}</p>
|
||||
*
|
||||
* @see #groups(String...)
|
||||
*/
|
||||
public TestNgOperation groups(Collection<String> group) {
|
||||
options.put("-groups", String.join(",", group));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore missed test names given by {@link #testNames(String...) testNames} and continue to run existing tests,
|
||||
* if any.
|
||||
|
@ -237,12 +263,25 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
/**
|
||||
* 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(Collection<String> listener) {
|
||||
options.put("-listener", String.join(",", listener));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Level of verbosity.
|
||||
*
|
||||
|
@ -257,22 +296,50 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
* Specifies the list of {@code .class} files or class names implementing {@code IMethodSelector}.
|
||||
*
|
||||
* <p>For example: {@code "com.example.Selector1:3", "com.example.Selector2:2"}</p>
|
||||
*
|
||||
* @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}.
|
||||
*
|
||||
* <p>For example: {@code "com.example.Selector1:3", "com.example.Selector2:2"}</p>
|
||||
*
|
||||
* @see #methodSelectors(String...)
|
||||
*/
|
||||
public TestNgOperation methodSelectors(Collection<String> selector) {
|
||||
options.put("-methodselectors", String.join(",", selector));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you specify individual methods to run.
|
||||
*
|
||||
* <p>For example: {@code "com.example.Foo.f1", "com.example.Bar.f2"}</p>
|
||||
*
|
||||
* @see #methods(Collection)
|
||||
*/
|
||||
public TestNgOperation methods(String... method) {
|
||||
options.put("-methods", String.join(",", method));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you specify individual methods to run.
|
||||
*
|
||||
* <p>For example: {@code "com.example.Foo.f1", "com.example.Bar.f2"}</p>
|
||||
*
|
||||
* @see #methods(String...)
|
||||
*/
|
||||
public TestNgOperation methods(Collection<String> method) {
|
||||
options.put("-methods", String.join(",", method));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mixed mode autodetects the type of current test and run it with appropriate runner.
|
||||
*
|
||||
|
@ -285,33 +352,74 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
|
||||
/**
|
||||
* 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(Collection<String> factory) {
|
||||
options.put("-objectfactory", String.join(",", factory));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of fully qualified class names of listeners that should be skipped from being wired in via
|
||||
* Service Loaders.
|
||||
*
|
||||
* @see #overrideIncludedMethods(Collection)
|
||||
*/
|
||||
public TestNgOperation overrideIncludedMethods(String... method) {
|
||||
options.put("-overrideincludedmethods", String.join(",", method));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of fully qualified class names of listeners that should be skipped from being wired in via
|
||||
* Service Loaders.
|
||||
*
|
||||
* @see #overrideIncludedMethods(String...)
|
||||
*/
|
||||
public TestNgOperation overrideIncludedMethods(Collection<String> method) {
|
||||
options.put("-overrideincludedmethods", String.join(",", method));
|
||||
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.
|
||||
*
|
||||
* <p>For example: {@code "com.example", "test.sample.*"}</p>
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* <p>For example: {@code "com.example", "test.sample.*"}</p>
|
||||
*
|
||||
* @see #packages(String...)
|
||||
*/
|
||||
public TestNgOperation packages(Collection<String> name) {
|
||||
packages.addAll(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If specified, sets the default mechanism used to determine how to use parallel threads when running tests.
|
||||
* If not set, default mechanism is not to use parallel threads at all.
|
||||
|
@ -354,21 +462,48 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
* 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(Collection<String> directory) {
|
||||
options.put("-sourcedir", String.join(";", directory));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the List of fully qualified class names of listeners that should be skipped from being wired in via
|
||||
* Service Loaders.
|
||||
*
|
||||
* @see #spiListenersToSkip(Collection)
|
||||
*/
|
||||
public TestNgOperation spiListenersToSkip(String... listenerToSkip) {
|
||||
options.put("-spilistenerstoskip", String.join(",", listenerToSkip));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the List of fully qualified class names of listeners that should be skipped from being wired in via
|
||||
* Service Loaders.
|
||||
*
|
||||
* @see #spiListenersToSkip(String...)
|
||||
*/
|
||||
public TestNgOperation spiListenersToSkip(Collection<String> listenerToSkip) {
|
||||
options.put("-spilistenerstoskip", String.join(",", listenerToSkip));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This specifies the default name of the test suite, if not specified in the suite definition file or source code.
|
||||
* This option is ignored if the {@code suite.xml} file or the source code specifies a different suite name.
|
||||
|
@ -391,12 +526,26 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
* Specifies the suites to run.
|
||||
*
|
||||
* <p>For example: {@code "testng.xml", "testng2.xml"}</p>
|
||||
*
|
||||
* @see #suites(Collection)
|
||||
*/
|
||||
public TestNgOperation suites(String... suite) {
|
||||
suites.addAll(Arrays.stream(suite).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the suites to run.
|
||||
*
|
||||
* <p>For example: {@code "testng.xml", "testng2.xml"}</p>
|
||||
*
|
||||
* @see #suites(String...)
|
||||
*/
|
||||
public TestNgOperation suites(Collection<String> suite) {
|
||||
suites.addAll(suite);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a test file and delete it on exit.
|
||||
*/
|
||||
|
@ -410,20 +559,46 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
* Specifies the list of class files.
|
||||
*
|
||||
* <p>For example: {@code "org.foo.Test1","org.foo.test2"}</p>
|
||||
*
|
||||
* @see #testClass(Collection)
|
||||
*/
|
||||
public TestNgOperation testClass(String... aClass) {
|
||||
options.put("-testclass", String.join(",", aClass));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the list of class files.
|
||||
*
|
||||
* <p>For example: {@code "org.foo.Test1","org.foo.test2"}</p>
|
||||
*
|
||||
* @see #testClass(String...)
|
||||
*/
|
||||
public TestNgOperation testClass(Collection<String> aClass) {
|
||||
options.put("-testclass", String.join(",", aClass));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the classpath entries used to run tests.
|
||||
*
|
||||
* @see #testClasspath(String...)
|
||||
*/
|
||||
public TestNgOperation testClasspath(String... entry) {
|
||||
testClasspath.addAll(Arrays.stream(entry).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the classpath entries used to run tests.
|
||||
*
|
||||
* @see #testClasspath(String...)
|
||||
*/
|
||||
public TestNgOperation testClasspath(Collection<String> entry) {
|
||||
testClasspath.addAll(entry);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a jar file that contains test classes. If a {@code testng.xml} file is found at the root of that
|
||||
* jar file, it will be used, otherwise, all the test classes found in this jar file will be considered test
|
||||
|
@ -445,12 +620,24 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
|||
|
||||
/**
|
||||
* Only tests defined in a {@code <test>} tag matching one of these names will be run.
|
||||
*
|
||||
* @see #testNames(Collection)
|
||||
*/
|
||||
public TestNgOperation testNames(String... name) {
|
||||
options.put("-testnames", Arrays.stream(name).map(s -> '"' + s + '"').collect(Collectors.joining(",")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only tests defined in a {@code <test>} tag matching one of these names will be run.
|
||||
*
|
||||
* @see #testName(String)
|
||||
*/
|
||||
public TestNgOperation testNames(Collection<String> name) {
|
||||
options.put("-testnames", name.stream().map(s -> '"' + s + '"').collect(Collectors.joining(",")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the factory used to create tests.
|
||||
*/
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
@ -20,6 +20,8 @@ import org.junit.jupiter.api.Test;
|
|||
import rife.bld.Project; // NOPMD
|
||||
import rife.bld.operations.exceptions.ExitStatusException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
/**
|
||||
|
@ -46,6 +48,10 @@ class TestNgOperationTest {
|
|||
void testClass() {
|
||||
var op = new TestNgOperation().testClass(FOO, BAR);
|
||||
assertThat(op.options.get(TestNgOperation.TEST_CLASS_ARG)).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
new TestNgOperation().testClass(List.of(FOO, BAR));
|
||||
assertThat(op.options.get(TestNgOperation.TEST_CLASS_ARG)).as("as list")
|
||||
.isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -70,6 +76,9 @@ class TestNgOperationTest {
|
|||
void testExcludeGroups() {
|
||||
var op = new TestNgOperation().excludeGroups(FOO, BAR);
|
||||
assertThat(op.options.get("-excludegroups")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
op = new TestNgOperation().excludeGroups(List.of(FOO, BAR));
|
||||
assertThat(op.options.get("-excludegroups")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -113,6 +122,14 @@ class TestNgOperationTest {
|
|||
.log(2)
|
||||
.execute())
|
||||
.as("with run classpath").doesNotThrowAnyException();
|
||||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.suites("src/test/resources/testng3.xml")
|
||||
.testClasspath(List.of("lib/test/*", "build/main", "build/test"))
|
||||
.log(2)
|
||||
.execute())
|
||||
.as("with run classpath as list").doesNotThrowAnyException();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -185,18 +202,27 @@ class TestNgOperationTest {
|
|||
void testListener() {
|
||||
var ops = new TestNgOperation().listener(FOO, BAR);
|
||||
assertThat(ops.options.get("-listener")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
ops = new TestNgOperation().listener(List.of(FOO, BAR));
|
||||
assertThat(ops.options.get("-listener")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMethodDetectors() {
|
||||
var op = new TestNgOperation().methodSelectors(FOO, BAR);
|
||||
assertThat(op.options.get("-methodselectors")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
op = new TestNgOperation().methodSelectors(List.of(FOO, BAR));
|
||||
assertThat(op.options.get("-methodselectors")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMethods() {
|
||||
var op = new TestNgOperation().methods(FOO, BAR);
|
||||
assertThat(op.options.get("-methods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
new TestNgOperation().methods(List.of(FOO, BAR));
|
||||
assertThat(op.options.get("-methods")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -218,24 +244,36 @@ class TestNgOperationTest {
|
|||
void testNames() {
|
||||
var ops = new TestNgOperation().testNames(FOO, BAR);
|
||||
assertThat(ops.options.get("-testnames")).isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
||||
|
||||
new TestNgOperation().testNames(List.of(FOO, BAR));
|
||||
assertThat(ops.options.get("-testnames")).as("as list").isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testObjectFactory() {
|
||||
var ops = new TestNgOperation().objectFactory(FOO, BAR);
|
||||
assertThat(ops.options.get("-objectfactory")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
ops = new TestNgOperation().objectFactory(List.of(FOO, BAR));
|
||||
assertThat(ops.options.get("-objectfactory")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOverrideIncludedMethods() {
|
||||
var ops = new TestNgOperation().overrideIncludedMethods(FOO, BAR);
|
||||
assertThat(ops.options.get("-overrideincludedmethods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
ops = new TestNgOperation().overrideIncludedMethods(List.of(FOO, BAR));
|
||||
assertThat(ops.options.get("-overrideincludedmethods")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPackages() {
|
||||
var op = new TestNgOperation().packages(FOO, BAR);
|
||||
assertThat(op.packages).contains(FOO).contains(BAR);
|
||||
|
||||
op = new TestNgOperation().packages(List.of(FOO, BAR));
|
||||
assertThat(op.packages).as("as list").contains(FOO).contains(BAR);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -281,12 +319,18 @@ class TestNgOperationTest {
|
|||
void testSourceDir() {
|
||||
var op = new TestNgOperation().sourceDir(FOO, BAR);
|
||||
assertThat(op.options.get("-sourcedir")).isEqualTo(String.format("%s;%s", FOO, BAR));
|
||||
|
||||
op = new TestNgOperation().sourceDir(List.of(FOO, BAR));
|
||||
assertThat(op.options.get("-sourcedir")).as("as list").isEqualTo(String.format("%s;%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSpiListenersToSkip() {
|
||||
var ops = new TestNgOperation().spiListenersToSkip(FOO, BAR);
|
||||
assertThat(ops.options.get("-spilistenerstoskip")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
ops = new TestNgOperation().spiListenersToSkip(List.of(FOO, BAR));
|
||||
assertThat(ops.options.get("-spilistenerstoskip")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -305,6 +349,9 @@ class TestNgOperationTest {
|
|||
void testSuites() {
|
||||
var op = new TestNgOperation().suites(FOO, BAR);
|
||||
assertThat(op.suites).contains(FOO).contains(BAR);
|
||||
|
||||
op = new TestNgOperation().suites(List.of(FOO, BAR));
|
||||
assertThat(op.suites).as("as list").contains(FOO).contains(BAR);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue