Compare commits
65 commits
Author | SHA1 | Date | |
---|---|---|---|
f43b3e18d2 | |||
0f7a7cf090 | |||
9625db4b62 | |||
8d4e858035 | |||
f2b7863bb2 | |||
d95cb2990d | |||
b9b7b0fb44 | |||
98ea8a7812 | |||
4a0ad1aebe | |||
f12eb82f99 | |||
8e2a2fa2fd | |||
0133572c46 | |||
c72607ff65 | |||
69cf0da32a | |||
d41df03d08 | |||
e4c47afcfc | |||
8632c7525c | |||
69d20a0ed1 | |||
d59d109aa9 | |||
251c8abb6a | |||
61d32ca117 | |||
807ccffe0e | |||
1ff935aa7e | |||
0f5dae6cdc | |||
a46ad60a66 | |||
450c2df0f5 | |||
e2695625fd | |||
f2cf1b18bb | |||
fd950f223d | |||
c35b3cefcd | |||
4e44484157 | |||
994bc399d6 | |||
d4931cc3af | |||
f462b1eca8 | |||
1ebc093bbc | |||
0cb08be61a | |||
7aedfc790e | |||
8db60b473c | |||
4fa74c3efd | |||
177ad3d961 | |||
057bb39247 | |||
0156100013 | |||
cd34bb182c | |||
0a869da1d5 | |||
b0cf0f5035 | |||
6020dde8eb | |||
273dbc014b | |||
a5ce6ab0ec | |||
cf879d30db | |||
b1db44062a | |||
155052a861 | |||
f822d4489e | |||
d74ee9d819 | |||
645e6d104a | |||
f9cbd63bce | |||
4d4479bf23 | |||
63635f408b | |||
b80ae060e0 | |||
b9e9714255 | |||
be3206f91b | |||
1e7c9724c0 | |||
f017dce3d9 | |||
1e23f03f46 | |||
cfa0a18581 | |||
d1e16bbee3 |
36 changed files with 782 additions and 333 deletions
29
.github/workflows/bld.yml
vendored
29
.github/workflows/bld.yml
vendored
|
@ -4,29 +4,36 @@ on: [ push, pull_request, workflow_dispatch ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bld-project:
|
build-bld-project:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [ 17, 20 ]
|
java-version: [ 17, 21, 24 ]
|
||||||
|
kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ]
|
||||||
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java-version }}
|
- name: Set up JDK ${{ matrix.java-version }}
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: "zulu"
|
||||||
java-version: ${{ matrix.java-version }}
|
java-version: ${{ matrix.java-version }}
|
||||||
|
|
||||||
- name: Grant execute permission for bld
|
- name: Download dependencies [examples]
|
||||||
run: chmod +x bld
|
working-directory: examples
|
||||||
|
|
||||||
- name: Download the dependencies
|
|
||||||
run: ./bld download
|
run: ./bld download
|
||||||
|
|
||||||
- name: Run tests with bld
|
- name: Run tests with JaCoCo [examples]
|
||||||
|
working-directory: examples
|
||||||
|
run: ./bld compile jacoco
|
||||||
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: ./bld download
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
run: ./bld compile test
|
run: ./bld compile test
|
12
.github/workflows/pages.yml
vendored
12
.github/workflows/pages.yml
vendored
|
@ -30,14 +30,14 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: "zulu"
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Build Javadocs
|
- name: Build Javadocs
|
||||||
|
@ -47,11 +47,11 @@ jobs:
|
||||||
uses: actions/configure-pages@v3
|
uses: actions/configure-pages@v3
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v1
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
# Upload generated Javadocs repository
|
# Upload generated Javadocs repository
|
||||||
path: 'build/javadoc/'
|
path: "build/javadoc/"
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v1
|
uses: actions/deploy-pages@v4
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -55,3 +55,4 @@ atlassian-ide-plugin.xml
|
||||||
.idea/httpRequests
|
.idea/httpRequests
|
||||||
|
|
||||||
local.properties
|
local.properties
|
||||||
|
test-output
|
||||||
|
|
6
.idea/bld.xml
generated
Normal file
6
.idea/bld.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BldConfiguration">
|
||||||
|
<events />
|
||||||
|
</component>
|
||||||
|
</project>
|
2
.idea/copyright/Apache_License.xml
generated
2
.idea/copyright/Apache_License.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="Copyright 2023-Copyright &#36;today.yearamp;#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 2023-&#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" />
|
<option name="myName" value="Apache License" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
13
.idea/icon.svg
generated
Normal file
13
.idea/icon.svg
generated
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 179 108" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<g transform="matrix(1,0,0,1,-210.511,-96.3382)">
|
||||||
|
<g transform="matrix(1,0,0,1,-23.3386,-649.816)">
|
||||||
|
<g transform="matrix(0.221288,0,0,0.24,73.9536,390.254)">
|
||||||
|
<path d="M722.568,1482.92L722.568,1921.1L808.968,1921.1L808.968,1888.7C822.168,1907.9 846.168,1930.1 893.568,1930.1C933.168,1930.1 961.968,1917.5 985.368,1893.5C1012.97,1865.9 1027.37,1827.5 1027.37,1786.1C1027.37,1741.7 1011.17,1705.1 985.368,1680.5C961.968,1658.3 928.968,1644.5 892.368,1644.5C862.968,1644.5 830.568,1654.1 808.968,1683.5L808.968,1482.92L722.568,1482.92ZM871.368,1718.9C888.768,1718.9 903.768,1723.7 917.568,1736.9C930.168,1748.9 938.568,1766.3 938.568,1787.9C938.568,1807.7 930.168,1825.1 917.568,1837.1C904.368,1849.7 887.568,1855.7 872.568,1855.7C856.368,1855.7 837.168,1849.1 823.368,1835.9C813.168,1826.3 803.568,1810.1 803.568,1787.9C803.568,1765.1 812.568,1749.5 822.768,1738.7C836.568,1724.3 852.768,1718.9 871.368,1718.9Z" style="fill:rgb(35,146,255);fill-rule:nonzero;"/>
|
||||||
|
<rect x="1083.77" y="1482.92" width="86.4" height="438.182" style="fill:rgb(250,144,82);fill-rule:nonzero;"/>
|
||||||
|
<path d="M1531.37,1482.92L1444.97,1482.92L1444.97,1683.5C1423.37,1654.1 1390.97,1644.5 1361.57,1644.5C1324.97,1644.5 1291.97,1658.3 1268.57,1680.5C1242.77,1705.1 1226.57,1741.7 1226.57,1786.1C1226.57,1827.5 1240.97,1865.9 1268.57,1893.5C1291.97,1917.5 1320.77,1930.1 1360.37,1930.1C1407.77,1930.1 1431.77,1907.9 1444.97,1888.7L1444.97,1921.1L1531.37,1921.1L1531.37,1482.92ZM1382.57,1718.9C1401.17,1718.9 1417.37,1724.3 1431.17,1738.7C1441.37,1749.5 1450.37,1765.1 1450.37,1787.9C1450.37,1810.1 1440.77,1826.3 1430.57,1835.9C1416.77,1849.1 1397.57,1855.7 1381.37,1855.7C1366.37,1855.7 1349.57,1849.7 1336.37,1837.1C1323.77,1825.1 1315.37,1807.7 1315.37,1787.9C1315.37,1766.3 1323.77,1748.9 1336.37,1736.9C1350.17,1723.7 1365.17,1718.9 1382.57,1718.9Z" style="fill:rgb(35,146,255);fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
4
.idea/libraries/bld.xml
generated
4
.idea/libraries/bld.xml
generated
|
@ -2,12 +2,12 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
|
4
.idea/libraries/compile.xml
generated
4
.idea/libraries/compile.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/runtime.xml
generated
4
.idea/libraries/runtime.xml
generated
|
@ -8,7 +8,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/test.xml
generated
4
.idea/libraries/test.xml
generated
|
@ -8,7 +8,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -9,7 +9,7 @@
|
||||||
],
|
],
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"${HOME}/.bld/dist/bld-1.9.0.jar",
|
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
||||||
"lib/**/*.jar"
|
"lib/**/*.jar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
42
README.md
42
README.md
|
@ -1,41 +1,30 @@
|
||||||
# [bld](https://rife2.com/bld) Extension to Run Tests with [TestNG](https://testng.org/)
|
# [bld](https://rife2.com/bld) Extension to Run Tests with [TestNG](https://testng.org/)
|
||||||
|
|
||||||
|
|
||||||
[](https://opensource.org/licenses/Apache-2.0)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||||
[](https://rife2.com/bld)
|
[](https://rife2.com/bld)
|
||||||
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-testng)
|
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-testng)
|
||||||
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-testng)
|
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-testng)
|
||||||
[](https://github.com/rife2/bld-testng/actions/workflows/bld.yml)
|
[](https://github.com/rife2/bld-testng/actions/workflows/bld.yml)
|
||||||
|
|
||||||
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
|
To install the latest version, add the following to the `lib/bld/bld-wrapper.properties` file:
|
||||||
|
|
||||||
|
```properties
|
||||||
|
bld.extension-testng=com.uwyn.rife2:bld-testng
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, please refer to the [extensions](https://github.com/rife2/bld/wiki/Extensions) documentation.
|
||||||
|
|
||||||
|
## Test with TestNG
|
||||||
|
|
||||||
To run the tests with TestNG, add the following to your build file:
|
To run the tests with TestNG, add the following to your build file:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@BuildCommand(summary = "Tests the project with TestNG")
|
@Override
|
||||||
public void testng() throws Exception {
|
public TestOperation<?, ?> testOperation() {
|
||||||
new TestNgOperation()
|
return new TestNgOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.packages("com.example")
|
.packages("com.example");
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```console
|
|
||||||
./bld compile testng
|
|
||||||
```
|
|
||||||
|
|
||||||
You could also override the default `test` command:
|
|
||||||
|
|
||||||
```java
|
|
||||||
@BuildCommand(summary = "Tests the project with TestNG")
|
|
||||||
public void test throws Exception {
|
|
||||||
new TestNgOperation()
|
|
||||||
.fromProject(this)
|
|
||||||
.suites("src/test/resources/testng.xml")
|
|
||||||
.verbose(2)
|
|
||||||
.execute();
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -53,6 +42,5 @@ Don't forget to add a TestNG `test` dependency to your build file, as it is not
|
||||||
|
|
||||||
```java
|
```java
|
||||||
repositories = List.of(MAVEN_CENTRAL);
|
repositories = List.of(MAVEN_CENTRAL);
|
||||||
scope(test).include(dependency("org.testng", "testng", version(7, 9, 0)));
|
scope(test).include(dependency("org.testng", "testng", version(7, 11, 0)));
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MAIN="org.testng.TestNG"
|
|
||||||
TMPNEW=/tmp/checkcliargs-new
|
|
||||||
TMPOLD=/tmp/checkcliargs-old
|
|
||||||
|
|
||||||
java -cp "lib/test/*" $MAIN >$TMPNEW
|
|
||||||
java -cp "examples/lib/test/*" $MAIN >$TMPOLD
|
|
||||||
|
|
||||||
diff $TMPOLD $TMPNEW
|
|
||||||
|
|
||||||
rm -rf $TMPNEW $TMPOLD
|
|
|
@ -7,9 +7,9 @@
|
||||||
<!-- BEST PRACTICES -->
|
<!-- BEST PRACTICES -->
|
||||||
<rule ref="category/java/bestpractices.xml">
|
<rule ref="category/java/bestpractices.xml">
|
||||||
<exclude name="AvoidPrintStackTrace"/>
|
<exclude name="AvoidPrintStackTrace"/>
|
||||||
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
|
|
||||||
<exclude name="JUnitTestContainsTooManyAsserts"/>
|
|
||||||
<exclude name="GuardLogStatement"/>
|
<exclude name="GuardLogStatement"/>
|
||||||
|
<exclude name="UnitTestContainsTooManyAsserts"/>
|
||||||
|
<exclude name="UnitTestShouldUseTestAnnotation"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
<rule ref="category/java/codestyle.xml">
|
<rule ref="category/java/codestyle.xml">
|
||||||
<exclude name="AtLeastOneConstructor"/>
|
<exclude name="AtLeastOneConstructor"/>
|
||||||
<exclude name="ClassNamingConventions"/>
|
<exclude name="ClassNamingConventions"/>
|
||||||
<exclude name="ConfusingTernary"/>
|
|
||||||
<exclude name="CommentDefaultAccessModifier"/>
|
<exclude name="CommentDefaultAccessModifier"/>
|
||||||
|
<exclude name="ConfusingTernary"/>
|
||||||
<exclude name="FieldNamingConventions"/>
|
<exclude name="FieldNamingConventions"/>
|
||||||
<exclude name="LocalVariableCouldBeFinal"/>
|
<exclude name="LocalVariableCouldBeFinal"/>
|
||||||
<exclude name="LongVariable"/>
|
<exclude name="LongVariable"/>
|
||||||
|
@ -35,8 +35,9 @@
|
||||||
<exclude name="ShortClassName"/>
|
<exclude name="ShortClassName"/>
|
||||||
<exclude name="ShortMethodName"/>
|
<exclude name="ShortMethodName"/>
|
||||||
<exclude name="ShortVariable"/>
|
<exclude name="ShortVariable"/>
|
||||||
<exclude name="UselessParentheses"/>
|
<exclude name="UseExplicitTypes"/>
|
||||||
<exclude name="UseUnderscoresInNumericLiterals"/>
|
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||||
|
<exclude name="UselessParentheses"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
||||||
|
@ -52,8 +53,6 @@
|
||||||
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
||||||
<exclude name="CognitiveComplexity"/>
|
<exclude name="CognitiveComplexity"/>
|
||||||
<exclude name="CyclomaticComplexity"/>
|
<exclude name="CyclomaticComplexity"/>
|
||||||
<exclude name="ExcessiveClassLength"/>
|
|
||||||
<exclude name="ExcessiveMethodLength"/>
|
|
||||||
<exclude name="ExcessiveParameterList"/>
|
<exclude name="ExcessiveParameterList"/>
|
||||||
<exclude name="ExcessivePublicCount"/>
|
<exclude name="ExcessivePublicCount"/>
|
||||||
<exclude name="GodClass"/>
|
<exclude name="GodClass"/>
|
||||||
|
|
6
examples/.idea/bld.xml
generated
Normal file
6
examples/.idea/bld.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BldConfiguration">
|
||||||
|
<events />
|
||||||
|
</component>
|
||||||
|
</project>
|
4
examples/.idea/libraries/bld.xml
generated
4
examples/.idea/libraries/bld.xml
generated
|
@ -2,12 +2,12 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.9.0-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
|
4
examples/.idea/libraries/compile.xml
generated
4
examples/.idea/libraries/compile.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
examples/.idea/libraries/runtime.xml
generated
4
examples/.idea/libraries/runtime.xml
generated
|
@ -8,7 +8,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
examples/.idea/libraries/test.xml
generated
4
examples/.idea/libraries/test.xml
generated
|
@ -8,7 +8,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
examples/.idea/misc.xml
generated
4
examples/.idea/misc.xml
generated
|
@ -3,6 +3,10 @@
|
||||||
<component name="EntryPointsManager">
|
<component name="EntryPointsManager">
|
||||||
<pattern value="com.example.ExamplesBuild" method="testng" />
|
<pattern value="com.example.ExamplesBuild" method="testng" />
|
||||||
<pattern value="com.example.ExampleTest" method="testFail" />
|
<pattern value="com.example.ExampleTest" method="testFail" />
|
||||||
|
<pattern value="com.example.ExamplesBuild" method="jacoco" />
|
||||||
|
<pattern value="com.example.ExamplesTest" />
|
||||||
|
<pattern value="com.example.ExamplesTest" method="foo" />
|
||||||
|
<pattern value="com.example.ExamplesTest" method="verifyHello" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PDMPlugin">
|
<component name="PDMPlugin">
|
||||||
<option name="customRuleSets">
|
<option name="customRuleSets">
|
||||||
|
|
2
examples/.vscode/settings.json
vendored
2
examples/.vscode/settings.json
vendored
|
@ -10,7 +10,7 @@
|
||||||
],
|
],
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"${HOME}/.bld/dist/bld-1.9.0.jar",
|
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
||||||
"lib/**/*.jar"
|
"lib/**/*.jar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,9 @@ Compile and Run Tests with TestNG
|
||||||
```console
|
```console
|
||||||
./bld compile test
|
./bld compile test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Compile and Generate JaCoCo Reports
|
||||||
|
|
||||||
|
```console
|
||||||
|
./bld compile jacoco
|
||||||
|
```
|
||||||
|
|
Binary file not shown.
|
@ -1,7 +1,8 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.extensions=com.uwyn.rife2:bld-testng:0.9.4
|
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10-SNAPSHOT
|
||||||
|
bld.extension-testng=com.uwyn.rife2:bld-testng:1.0.3-SNAPSHOT
|
||||||
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.sourceDirectories=
|
bld.sourceDirectories=
|
||||||
bld.version=1.9.0
|
bld.version=2.2.1
|
||||||
|
|
|
@ -2,9 +2,14 @@ package com.example;
|
||||||
|
|
||||||
import rife.bld.BaseProject;
|
import rife.bld.BaseProject;
|
||||||
import rife.bld.BuildCommand;
|
import rife.bld.BuildCommand;
|
||||||
|
import rife.bld.extension.JacocoReportOperation;
|
||||||
import rife.bld.extension.TestNgOperation;
|
import rife.bld.extension.TestNgOperation;
|
||||||
|
import rife.bld.operations.TestOperation;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.ConsoleHandler;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||||
import static rife.bld.dependencies.Scope.test;
|
import static rife.bld.dependencies.Scope.test;
|
||||||
|
@ -12,9 +17,10 @@ import static rife.bld.dependencies.Scope.test;
|
||||||
/**
|
/**
|
||||||
* Example build.
|
* Example build.
|
||||||
*
|
*
|
||||||
* <ul style="list-style-type:none">
|
* <pre>{@code
|
||||||
* <li>./bld compile test</li>
|
* ./bld compile test
|
||||||
* </ul>
|
* ./bld compile jacoco
|
||||||
|
* }</pre>
|
||||||
*/
|
*/
|
||||||
public class ExamplesBuild extends BaseProject {
|
public class ExamplesBuild extends BaseProject {
|
||||||
public ExamplesBuild() {
|
public ExamplesBuild() {
|
||||||
|
@ -22,23 +28,41 @@ public class ExamplesBuild extends BaseProject {
|
||||||
name = "Examples";
|
name = "Examples";
|
||||||
version = version(0, 1, 0);
|
version = version(0, 1, 0);
|
||||||
|
|
||||||
|
javaRelease = 17;
|
||||||
|
|
||||||
downloadSources = true;
|
downloadSources = true;
|
||||||
autoDownloadPurge = true;
|
autoDownloadPurge = true;
|
||||||
|
|
||||||
repositories = List.of(MAVEN_CENTRAL);
|
repositories = List.of(MAVEN_CENTRAL);
|
||||||
|
|
||||||
scope(test).include(dependency("org.testng", "testng", version(7, 9, 0)));
|
scope(test).include(dependency("org.testng", "testng", version(7, 11, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
// Enable detailed logging for the JaCoCo extension
|
||||||
|
var level = Level.ALL;
|
||||||
|
var logger = Logger.getLogger("rife.bld.extension");
|
||||||
|
var consoleHandler = new ConsoleHandler();
|
||||||
|
|
||||||
|
consoleHandler.setLevel(level);
|
||||||
|
logger.addHandler(consoleHandler);
|
||||||
|
logger.setLevel(level);
|
||||||
|
logger.setUseParentHandlers(false);
|
||||||
|
|
||||||
new ExamplesBuild().start(args);
|
new ExamplesBuild().start(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BuildCommand(summary = "Tests the project with TestNG")
|
@BuildCommand(summary = "Generates Jacoco Reports")
|
||||||
public void test() throws Exception {
|
public void jacoco() throws Exception {
|
||||||
new TestNgOperation()
|
new JacocoReportOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.packages("com.example")
|
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TestOperation<?, ?> testOperation() {
|
||||||
|
return new TestNgOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.packages("com.example");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -1,7 +1,8 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.7
|
|
||||||
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
|
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.4
|
||||||
|
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.1
|
||||||
|
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.sourceDirectories=
|
bld.sourceDirectories=
|
||||||
bld.version=1.9.0
|
bld.version=2.2.1
|
||||||
|
|
16
scripts/checkcliargs.sh
Executable file
16
scripts/checkcliargs.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
main="org.testng.TestNG"
|
||||||
|
new=/tmp/checkcliargs-new
|
||||||
|
old=/tmp/checkcliargs-old
|
||||||
|
|
||||||
|
java -cp "lib/test/*" $main 2>/dev/null >$new
|
||||||
|
java -cp "examples/lib/test/*" $main 2>/dev/null >$old
|
||||||
|
|
||||||
|
if [ "$1" = "-v" ]; then
|
||||||
|
code --wait --diff $old $new
|
||||||
|
else
|
||||||
|
diff $old $new
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf $new $old
|
9
scripts/cliargs.sh
Executable file
9
scripts/cliargs.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
java -cp "lib/test/*" org.testng.TestNG 2>/dev/null |\
|
||||||
|
grep "^ -.*" |\
|
||||||
|
sed -e "s/ -/-/" -e "s/, -/\n-/" |\
|
||||||
|
sed "/testRunFactory/d" |\
|
||||||
|
sort |\
|
||||||
|
sed '$s/,//' > "src/test/resources/testng-args.txt"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,8 +24,7 @@ import rife.bld.publish.PublishScm;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
import static rife.bld.dependencies.Repository.*;
|
||||||
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
|
|
||||||
import static rife.bld.dependencies.Scope.compile;
|
import static rife.bld.dependencies.Scope.compile;
|
||||||
import static rife.bld.dependencies.Scope.test;
|
import static rife.bld.dependencies.Scope.test;
|
||||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||||
|
@ -34,23 +33,23 @@ public class TestNgOperationBuild extends Project {
|
||||||
public TestNgOperationBuild() {
|
public TestNgOperationBuild() {
|
||||||
pkg = "rife.bld.extension";
|
pkg = "rife.bld.extension";
|
||||||
name = "bld-testng";
|
name = "bld-testng";
|
||||||
version = version(0, 9, 4);
|
version = version(1, 0, 3, "SNAPSHOT");
|
||||||
|
|
||||||
javaRelease = 17;
|
javaRelease = 17;
|
||||||
|
|
||||||
downloadSources = true;
|
downloadSources = true;
|
||||||
autoDownloadPurge = true;
|
autoDownloadPurge = true;
|
||||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
|
||||||
|
|
||||||
var rife2 = version(1, 7, 3);
|
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
||||||
|
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("com.uwyn.rife2", "rife2", rife2))
|
.include(dependency("com.uwyn.rife2", "bld", version(2, 2, 1)));
|
||||||
.include(dependency("com.uwyn.rife2", "bld", version(1, 9, 0)));
|
|
||||||
|
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.testng", "testng", version(7, 9, 0)))
|
.include(dependency("org.testng", "testng", version(7, 11, 0)))
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1)))
|
||||||
.include(dependency("org.assertj", "assertj-core", version(3, 25, 3)));
|
.include(dependency("org.assertj", "assertj-core", version(3, 27, 3)));
|
||||||
|
|
||||||
javadocOperation()
|
javadocOperation()
|
||||||
.javadocOptions()
|
.javadocOptions()
|
||||||
|
@ -61,25 +60,23 @@ public class TestNgOperationBuild extends Project {
|
||||||
|
|
||||||
publishOperation()
|
publishOperation()
|
||||||
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
||||||
|
.repository(repository("github"))
|
||||||
.info()
|
.info()
|
||||||
.groupId("com.uwyn.rife2")
|
.groupId("com.uwyn.rife2")
|
||||||
.artifactId("bld-testng")
|
.artifactId("bld-testng")
|
||||||
.description("bld Extension to execute tests with TestNG")
|
.description("bld Extension to execute tests with TestNG")
|
||||||
.url("https://github.com/rife2/bld-testng")
|
.url("https://github.com/rife2/bld-testng")
|
||||||
.developer(
|
.developer(new PublishDeveloper()
|
||||||
new PublishDeveloper()
|
|
||||||
.id("ethauvin")
|
.id("ethauvin")
|
||||||
.name("Erik C. Thauvin")
|
.name("Erik C. Thauvin")
|
||||||
.email("erik@thauvin.net")
|
.email("erik@thauvin.net")
|
||||||
.url("https://erik.thauvin.net/")
|
.url("https://erik.thauvin.net/")
|
||||||
)
|
)
|
||||||
.license(
|
.license(new PublishLicense()
|
||||||
new PublishLicense()
|
|
||||||
.name("The Apache License, Version 2.0")
|
.name("The Apache License, Version 2.0")
|
||||||
.url("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||||
)
|
)
|
||||||
.scm(
|
.scm(new PublishScm()
|
||||||
new PublishScm()
|
|
||||||
.connection("scm:git:https://github.com/rife2/bld-testng.git")
|
.connection("scm:git:https://github.com/rife2/bld-testng.git")
|
||||||
.developerConnection("scm:git:git@github.com:rife2/bld-testng.git")
|
.developerConnection("scm:git:git@github.com:rife2/bld-testng.git")
|
||||||
.url("https://github.com/rife2/bld-testng")
|
.url("https://github.com/rife2/bld-testng")
|
||||||
|
@ -93,11 +90,23 @@ public class TestNgOperationBuild extends Project {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BuildCommand(summary = "Runs PMD analysis")
|
@BuildCommand(summary = "Runs PMD analysis")
|
||||||
public void pmd() {
|
public void pmd() throws Exception {
|
||||||
new PmdOperation()
|
new PmdOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.failOnViolation(true)
|
.failOnViolation(true)
|
||||||
.ruleSets("config/pmd.xml")
|
.ruleSets("config/pmd.xml")
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test() throws Exception {
|
||||||
|
var os = System.getProperty("os.name");
|
||||||
|
if (os != null && os.toLowerCase().contains("linux")) {
|
||||||
|
new ExecOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.command("scripts/cliargs.sh")
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
super.test();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -17,7 +17,8 @@
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
import rife.bld.BaseProject;
|
import rife.bld.BaseProject;
|
||||||
import rife.bld.operations.AbstractProcessOperation;
|
import rife.bld.operations.TestOperation;
|
||||||
|
import rife.bld.operations.exceptions.ExitStatusException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -37,25 +38,29 @@ import java.util.stream.Collectors;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.TestClassWithoutTestCases")
|
@SuppressWarnings("PMD.TestClassWithoutTestCases")
|
||||||
public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
public class TestNgOperation extends TestOperation<TestNgOperation, List<String>> {
|
||||||
private static final Logger LOGGER = Logger.getLogger(TestNgOperation.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(TestNgOperation.class.getName());
|
||||||
|
/**
|
||||||
|
* The methods to run.
|
||||||
|
*/
|
||||||
|
private final Set<String> methods_ = new HashSet<>();
|
||||||
/**
|
/**
|
||||||
* The run options.
|
* The run options.
|
||||||
*/
|
*/
|
||||||
protected final Map<String, String> options = new ConcurrentHashMap<>();
|
private final Map<String, String> options_ = new ConcurrentHashMap<>();
|
||||||
/**
|
/**
|
||||||
* The suite packages to run.
|
* The suite packages to run.
|
||||||
*/
|
*/
|
||||||
protected final Set<String> packages = new HashSet<>();
|
private final Set<String> packages_ = new HashSet<>();
|
||||||
/**
|
/**
|
||||||
* The suites to run.
|
* The suites to run.
|
||||||
*/
|
*/
|
||||||
protected final Set<String> suites = new HashSet<>();
|
private final Set<String> suites_ = new HashSet<>();
|
||||||
/**
|
/**
|
||||||
* The classpath entries used for running tests.
|
* The classpath entries used for running tests.
|
||||||
*/
|
*/
|
||||||
protected final Set<String> testClasspath = new HashSet<>();
|
private final Set<String> testClasspath_ = new HashSet<>();
|
||||||
private BaseProject project;
|
private BaseProject project_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should Method Invocation Listeners be run even for skipped methods.
|
* Should Method Invocation Listeners be run even for skipped methods.
|
||||||
|
@ -66,10 +71,23 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation alwaysRunListeners(Boolean isAlwaysRunListeners) {
|
public TestNgOperation alwaysRunListeners(Boolean isAlwaysRunListeners) {
|
||||||
options.put("-alwaysrunlisteners", String.valueOf(isAlwaysRunListeners));
|
options_.put("-alwaysrunlisteners", String.valueOf(isAlwaysRunListeners));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildClassPath(String... path) {
|
||||||
|
var classpath = new StringBuilder();
|
||||||
|
for (var p : path) {
|
||||||
|
if (!p.isBlank()) {
|
||||||
|
if (!classpath.isEmpty()) {
|
||||||
|
classpath.append(File.pathSeparator);
|
||||||
|
}
|
||||||
|
classpath.append(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return classpath.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This sets the default maximum number of threads to use for data providers when running tests in parallel.
|
* 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
|
* It will only take effect if the parallel mode has been selected (for example,with the
|
||||||
|
@ -80,7 +98,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation dataProviderThreadCount(int count) {
|
public TestNgOperation dataProviderThreadCount(int count) {
|
||||||
if (count >= 0) {
|
if (count >= 0) {
|
||||||
options.put("-dataproviderthreadcount", String.valueOf(count));
|
options_.put("-dataproviderthreadcount", String.valueOf(count));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +111,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation dependencyInjectorFactory(String injectorFactory) {
|
public TestNgOperation dependencyInjectorFactory(String injectorFactory) {
|
||||||
if (isNotBlank(injectorFactory)) {
|
if (isNotBlank(injectorFactory)) {
|
||||||
options.put("-dependencyinjectorfactory", injectorFactory);
|
options_.put("-dependencyinjectorfactory", injectorFactory);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -108,11 +126,35 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation directory(String directoryPath) {
|
public TestNgOperation directory(String directoryPath) {
|
||||||
if (isNotBlank(directoryPath)) {
|
if (isNotBlank(directoryPath)) {
|
||||||
options.put("-d", directoryPath);
|
options_.put("-d", directoryPath);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The directory where the reports will be generated
|
||||||
|
*
|
||||||
|
* <p>Default is {@code build/test-output})</p>
|
||||||
|
*
|
||||||
|
* @param directoryPath the directory path
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public TestNgOperation directory(File directoryPath) {
|
||||||
|
return directory(directoryPath.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The directory where the reports will be generated
|
||||||
|
*
|
||||||
|
* <p>Default is {@code build/test-output})</p>
|
||||||
|
*
|
||||||
|
* @param directoryPath the directory path
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public TestNgOperation directory(Path directoryPath) {
|
||||||
|
return directory(directoryPath.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of groups you want to be excluded from this run.
|
* The list of groups you want to be excluded from this run.
|
||||||
*
|
*
|
||||||
|
@ -121,8 +163,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #excludeGroups(Collection) #excludeGroups(Collection)
|
* @see #excludeGroups(Collection) #excludeGroups(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation excludeGroups(String... group) {
|
public TestNgOperation excludeGroups(String... group) {
|
||||||
options.put("-excludegroups", String.join(",", Arrays.stream(group).filter(this::isNotBlank).toList()));
|
return excludeGroups(List.of(group));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,59 +174,90 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #excludeGroups(String...) #excludeGroups(String...)
|
* @see #excludeGroups(String...) #excludeGroups(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation excludeGroups(Collection<String> group) {
|
public TestNgOperation excludeGroups(Collection<String> group) {
|
||||||
options.put("-excludegroups", String.join(",", group.stream().filter(this::isNotBlank).toList()));
|
options_.put("-excludegroups", String.join(",", group.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws IOException, InterruptedException, ExitStatusException {
|
||||||
|
if (project_ == null) {
|
||||||
|
if (LOGGER.isLoggable(Level.SEVERE) && !silent()) {
|
||||||
|
LOGGER.severe("A project must be specified.");
|
||||||
|
}
|
||||||
|
throw new ExitStatusException(ExitStatusException.EXIT_FAILURE);
|
||||||
|
} else if (packages_.isEmpty() && suites_.isEmpty() && methods_.isEmpty()) {
|
||||||
|
if (LOGGER.isLoggable(Level.SEVERE) && !silent()) {
|
||||||
|
LOGGER.severe("At least an XML suite, package or method is required.");
|
||||||
|
}
|
||||||
|
throw new ExitStatusException(ExitStatusException.EXIT_FAILURE);
|
||||||
|
} else {
|
||||||
|
super.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Part of the {@link #execute execute} operation, constructs the command list to use for building the process.
|
* Part of the {@link #execute execute} operation, constructs the command list to use for building the process.
|
||||||
*
|
*
|
||||||
* @return the command list
|
* @return the command list
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
|
||||||
protected List<String> executeConstructProcessCommandList() {
|
protected List<String> executeConstructProcessCommandList() {
|
||||||
if (project == null) {
|
|
||||||
LOGGER.severe("A project must be specified.");
|
|
||||||
} else if (packages.isEmpty() && suites.isEmpty()) {
|
|
||||||
LOGGER.severe("At least one package or XML suite is required.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options.containsKey("-d")) {
|
|
||||||
options.put("d", Path.of(project.buildDirectory().getPath(), "test-output").toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> args = new ArrayList<>();
|
final List<String> args = new ArrayList<>();
|
||||||
|
|
||||||
|
if (project_ != null) {
|
||||||
|
if (!options_.containsKey("-d")) {
|
||||||
|
options_.put("-d", new File(project_.buildDirectory(), "test-output").getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
args.add(javaTool());
|
args.add(javaTool());
|
||||||
|
args.addAll(javaOptions());
|
||||||
|
|
||||||
args.add("-cp");
|
args.add("-cp");
|
||||||
if (testClasspath.isEmpty()) {
|
if (testClasspath_.isEmpty()) {
|
||||||
args.add(String.format("%s:%s:%s:%s", Path.of(project.libTestDirectory().getPath(), "*"),
|
args.add(buildClassPath(joinClasspathJar(project_.testClasspathJars()),
|
||||||
Path.of(project.libCompileDirectory().getPath(), "*"), project.buildMainDirectory(),
|
joinClasspathJar(project_.compileClasspathJars()),
|
||||||
project.buildTestDirectory()));
|
joinClasspathJar(project_.providedClasspathJars()),
|
||||||
|
project_.buildMainDirectory().getAbsolutePath(),
|
||||||
|
project_.buildTestDirectory().getAbsolutePath()));
|
||||||
} else {
|
} else {
|
||||||
args.add(String.join(":", testClasspath));
|
args.add(String.join(File.pathSeparator, testClasspath_));
|
||||||
}
|
}
|
||||||
|
|
||||||
args.add("org.testng.TestNG");
|
args.add("org.testng.TestNG");
|
||||||
|
|
||||||
options.forEach((k, v) -> {
|
options_.forEach((k, v) -> {
|
||||||
args.add(k);
|
args.add(k);
|
||||||
args.add(v);
|
args.add(v);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!suites.isEmpty()) {
|
if (!suites_.isEmpty()) {
|
||||||
args.addAll(suites);
|
args.addAll(suites_);
|
||||||
} else if (!options.containsKey("-testclass")) {
|
} else if (!options_.containsKey("-testclass")) {
|
||||||
try {
|
try {
|
||||||
args.add(writeDefaultSuite().getPath());
|
args.add(writeDefaultSuite().getAbsolutePath());
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
LOGGER.log(Level.SEVERE, "An IO error occurred while accessing the default testng.xml file", ioe);
|
if (LOGGER.isLoggable(Level.SEVERE) && !silent()) {
|
||||||
|
LOGGER.severe("An IO error occurred while accessing the default testng.xml file: "
|
||||||
|
+ ioe.getMessage());
|
||||||
|
}
|
||||||
|
throw new RuntimeException(ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOGGER.isLoggable(Level.INFO)) {
|
if (!methods_.isEmpty()) {
|
||||||
LOGGER.info(String.join(" ", args));
|
args.add("-methods");
|
||||||
LOGGER.info(String.format("Report will be saved in file://%s", new File(options.get("-d"))));
|
args.add(String.join(",", methods_));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOGGER.isLoggable(Level.FINE) && !silent()) {
|
||||||
|
LOGGER.fine(String.join(" ", args));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOGGER.isLoggable(Level.INFO) && !silent()) {
|
||||||
|
LOGGER.info(String.format("Report will be saved in file://%s",
|
||||||
|
new File(options_.get("-d")).toURI().getPath()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
|
@ -199,7 +271,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TestNgOperation fromProject(BaseProject project) {
|
public TestNgOperation fromProject(BaseProject project) {
|
||||||
this.project = project;
|
project_ = project;
|
||||||
directory(Path.of(project.buildDirectory().getPath(), "test-output").toString());
|
directory(Path.of(project.buildDirectory().getPath(), "test-output").toString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +283,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation failWhenEverythingSkipped(Boolean isFailAllSkipped) {
|
public TestNgOperation failWhenEverythingSkipped(Boolean isFailAllSkipped) {
|
||||||
options.put("-failwheneverythingskipped", String.valueOf(isFailAllSkipped));
|
options_.put("-failwheneverythingskipped", String.valueOf(isFailAllSkipped));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,12 +295,13 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation failurePolicy(FailurePolicy policy) {
|
public TestNgOperation failurePolicy(FailurePolicy policy) {
|
||||||
options.put("-configfailurepolicy", policy.name().toLowerCase(Locale.getDefault()));
|
options_.put("-configfailurepolicy", policy.name().toLowerCase(Locale.getDefault()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should TestNG consider failures in Data Providers as test failures.
|
* Should TestNG generate results on a per-suite basis by creating a subdirectory for each suite and dumping
|
||||||
|
* results into it.
|
||||||
*
|
*
|
||||||
* <p>Default is {@code false}</p>.
|
* <p>Default is {@code false}</p>.
|
||||||
*
|
*
|
||||||
|
@ -236,7 +309,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation generateResultsPerSuite(Boolean resultsPerSuite) {
|
public TestNgOperation generateResultsPerSuite(Boolean resultsPerSuite) {
|
||||||
options.put("-generateResultsPerSuite", String.valueOf(resultsPerSuite));
|
options_.put("-generateResultsPerSuite", String.valueOf(resultsPerSuite));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,8 +323,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #groups(Collection) #groups(Collection)
|
* @see #groups(Collection) #groups(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation groups(String... group) {
|
public TestNgOperation groups(String... group) {
|
||||||
options.put("-groups", String.join(",", Arrays.stream(group).filter(this::isNotBlank).toList()));
|
return groups(List.of(group));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,7 +336,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #groups(String...) #groups(String...)
|
* @see #groups(String...) #groups(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation groups(Collection<String> group) {
|
public TestNgOperation groups(Collection<String> group) {
|
||||||
options.put("-groups", String.join(",", group.stream().filter(this::isNotBlank).toList()));
|
options_.put("-groups", String.join(",", group.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +350,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation ignoreMissedTestName(Boolean isIgnoreMissedTestNames) {
|
public TestNgOperation ignoreMissedTestName(Boolean isIgnoreMissedTestNames) {
|
||||||
options.put("-ignoreMissedTestNames", String.valueOf(isIgnoreMissedTestNames));
|
options_.put("-ignoreMissedTestNames", String.valueOf(isIgnoreMissedTestNames));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +363,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation includeAllDataDrivenTestsWhenSkipping(Boolean isIncludeDrivenTestsWhenSkipping) {
|
public TestNgOperation includeAllDataDrivenTestsWhenSkipping(Boolean isIncludeDrivenTestsWhenSkipping) {
|
||||||
options.put("-includeAllDataDrivenTestsWhenSkipping", String.valueOf(isIncludeDrivenTestsWhenSkipping));
|
options_.put("-includeAllDataDrivenTestsWhenSkipping", String.valueOf(isIncludeDrivenTestsWhenSkipping));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,10 +383,18 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation jUnit(Boolean isJunit) {
|
public TestNgOperation jUnit(Boolean isJunit) {
|
||||||
options.put("-junit", String.valueOf(isJunit));
|
options_.put("-junit", String.valueOf(isJunit));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String joinClasspathJar(List<File> jars) {
|
||||||
|
if (!jars.isEmpty()) {
|
||||||
|
return String.join(File.pathSeparator, jars.stream().map(File::getAbsolutePath).toList());
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of {@code .class} files or list of class names implementing {@code ITestListener} or
|
* The list of {@code .class} files or list of class names implementing {@code ITestListener} or
|
||||||
* {@code ISuiteListener}
|
* {@code ISuiteListener}
|
||||||
|
@ -324,8 +404,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #listener(Collection) #listener(Collection)
|
* @see #listener(Collection) #listener(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation listener(String... listener) {
|
public TestNgOperation listener(String... listener) {
|
||||||
options.put("-listener", String.join(",", Arrays.stream(listener).filter(this::isNotBlank).toList()));
|
return listener(List.of(listener));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,7 +416,30 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #listener(String...) #listener(String...)
|
* @see #listener(String...) #listener(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation listener(Collection<String> listener) {
|
public TestNgOperation listener(Collection<String> listener) {
|
||||||
options.put("-listener", String.join(",", listener.stream().filter(this::isNotBlank).toList()));
|
options_.put("-listener", String.join(",", listener.stream().filter(this::isNotBlank).toList()));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An implementation of {@code ListenerComparator} that will be used by TestNG to determine order of execution for
|
||||||
|
* listeners.
|
||||||
|
*
|
||||||
|
* @param listenerComparator the listener comparator
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public TestNgOperation listenerComparator(String listenerComparator) {
|
||||||
|
options_.put("-listenercomparator", listenerComparator);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The factory used to create TestNG listeners.
|
||||||
|
*
|
||||||
|
* @param listenerFactory the listener factory
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public TestNgOperation listenerFactory(String listenerFactory) {
|
||||||
|
options_.put("-listenerfactory", listenerFactory);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +452,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation log(int level) {
|
public TestNgOperation log(int level) {
|
||||||
if (level >= 0) {
|
if (level >= 0) {
|
||||||
options.put("-log", String.valueOf(level));
|
options_.put("-log", String.valueOf(level));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -365,9 +467,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #methodSelectors(Collection) #methodSelectors(Collection)
|
* @see #methodSelectors(Collection) #methodSelectors(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation methodSelectors(String... selector) {
|
public TestNgOperation methodSelectors(String... selector) {
|
||||||
options.put("-methodselectors",
|
return methodSelectors(List.of(selector));
|
||||||
String.join(",", Arrays.stream(selector).filter(this::isNotBlank).toList()));
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -380,7 +480,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #methodSelectors(String...) #methodSelectors(String...)
|
* @see #methodSelectors(String...) #methodSelectors(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation methodSelectors(Collection<String> selector) {
|
public TestNgOperation methodSelectors(Collection<String> selector) {
|
||||||
options.put("-methodselectors", String.join(",", selector.stream().filter(this::isNotBlank).toList()));
|
options_.put("-methodselectors", String.join(",", selector.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,8 +494,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #methods(Collection) #methods(Collection)
|
* @see #methods(Collection) #methods(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation methods(String... method) {
|
public TestNgOperation methods(String... method) {
|
||||||
options.put("-methods", String.join(",", Arrays.stream(method).filter(this::isNotBlank).toList()));
|
return methods(List.of(method));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -408,10 +507,19 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #methods(String...) #methods(String...)
|
* @see #methods(String...) #methods(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation methods(Collection<String> method) {
|
public TestNgOperation methods(Collection<String> method) {
|
||||||
options.put("-methods", String.join(",", method.stream().filter(this::isNotBlank).toList()));
|
methods_.addAll(method);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the methods to run.
|
||||||
|
*
|
||||||
|
* @return the set of methods
|
||||||
|
*/
|
||||||
|
public Set<String> methods() {
|
||||||
|
return methods_;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mixed mode autodetects the type of current test and run it with appropriate runner.
|
* Mixed mode autodetects the type of current test and run it with appropriate runner.
|
||||||
*
|
*
|
||||||
|
@ -421,34 +529,48 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation mixed(Boolean isMixed) {
|
public TestNgOperation mixed(Boolean isMixed) {
|
||||||
options.put("-mixed", String.valueOf(isMixed));
|
options_.put("-mixed", String.valueOf(isMixed));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
|
* The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
|
||||||
|
* <p>
|
||||||
|
* A fully qualified class name that implements {@code org.testng.ITestObjectFactory} which can be used to create
|
||||||
|
* test class and listener instances.
|
||||||
*
|
*
|
||||||
* @param factory one or more factories
|
* @param factory one or more factory
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
* @see #objectFactory(Collection) #objectFactory(Collection)
|
* @see #objectFactory(Collection) #objectFactory(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation objectFactory(String... factory) {
|
public TestNgOperation objectFactory(String... factory) {
|
||||||
options.put("-objectfactory", String.join(",", Arrays.stream(factory).filter(this::isNotBlank).toList()));
|
return objectFactory(List.of(factory));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
|
* The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
|
||||||
|
* <p>
|
||||||
|
* A fully qualified class name that implements {@code org.testng.ITestObjectFactory} which can be used to create
|
||||||
|
* test class and listener instances.
|
||||||
*
|
*
|
||||||
* @param factory the list of factories
|
* @param factory the list of factories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
* @see #objectFactory(String...) #objectFactory(String...)
|
* @see #objectFactory(String...) #objectFactory(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation objectFactory(Collection<String> factory) {
|
public TestNgOperation objectFactory(Collection<String> factory) {
|
||||||
options.put("-objectfactory", String.join(",", factory.stream().filter(this::isNotBlank).toList()));
|
options_.put("-objectfactory", String.join(",", factory.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the run options.
|
||||||
|
*
|
||||||
|
* @return the map of run options
|
||||||
|
*/
|
||||||
|
public Map<String, String> options() {
|
||||||
|
return options_;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of fully qualified class names of listeners that should be skipped from being wired in via
|
* The list of fully qualified class names of listeners that should be skipped from being wired in via
|
||||||
* Service Loaders.
|
* Service Loaders.
|
||||||
|
@ -458,9 +580,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #overrideIncludedMethods(Collection) #overrideIncludedMethods(Collection)
|
* @see #overrideIncludedMethods(Collection) #overrideIncludedMethods(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation overrideIncludedMethods(String... method) {
|
public TestNgOperation overrideIncludedMethods(String... method) {
|
||||||
options.put("-overrideincludedmethods",
|
return overrideIncludedMethods(List.of(method));
|
||||||
String.join(",", Arrays.stream(method).filter(this::isNotBlank).toList()));
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -472,7 +592,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #overrideIncludedMethods(String...) #overrideIncludedMethods(String...)
|
* @see #overrideIncludedMethods(String...) #overrideIncludedMethods(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation overrideIncludedMethods(Collection<String> method) {
|
public TestNgOperation overrideIncludedMethods(Collection<String> method) {
|
||||||
options.put("-overrideincludedmethods", String.join(",", method.stream().filter(this::isNotBlank).toList()));
|
options_.put("-overrideincludedmethods", String.join(",", method.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,8 +608,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #packages(Collection) #packages(Collection)
|
* @see #packages(Collection) #packages(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation packages(String... name) {
|
public TestNgOperation packages(String... name) {
|
||||||
packages.addAll(Arrays.stream(name).filter(this::isNotBlank).toList());
|
return packages(List.of(name));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -504,10 +623,19 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #packages(String...) #packages(String...)
|
* @see #packages(String...) #packages(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation packages(Collection<String> name) {
|
public TestNgOperation packages(Collection<String> name) {
|
||||||
packages.addAll(name.stream().filter(this::isNotBlank).toList());
|
packages_.addAll(name.stream().filter(this::isNotBlank).toList());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the suite packages to run.
|
||||||
|
*
|
||||||
|
* @return the set of packages
|
||||||
|
*/
|
||||||
|
public Set<String> packages() {
|
||||||
|
return packages_;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified, sets the default mechanism used to determine how to use parallel threads when running tests.
|
* 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.
|
* If not set, default mechanism is not to use parallel threads at all.
|
||||||
|
@ -518,7 +646,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see Parallel
|
* @see Parallel
|
||||||
*/
|
*/
|
||||||
public TestNgOperation parallel(Parallel mechanism) {
|
public TestNgOperation parallel(Parallel mechanism) {
|
||||||
options.put("-parallel", mechanism.name().toLowerCase(Locale.getDefault()));
|
options_.put("-parallel", mechanism.name().toLowerCase(Locale.getDefault()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +658,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation port(int port) {
|
public TestNgOperation port(int port) {
|
||||||
if (port >= 1) {
|
if (port >= 1) {
|
||||||
options.put("-port", String.valueOf(port));
|
options_.put("-port", String.valueOf(port));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +672,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation propagateDataProviderFailureAsTestFailure(Boolean isPropagateDataProviderFailure) {
|
public TestNgOperation propagateDataProviderFailureAsTestFailure(Boolean isPropagateDataProviderFailure) {
|
||||||
options.put("-propagateDataProviderFailureAsTestFailure", String.valueOf(isPropagateDataProviderFailure));
|
options_.put("-propagateDataProviderFailureAsTestFailure", String.valueOf(isPropagateDataProviderFailure));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +684,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation reporter(String reporter) {
|
public TestNgOperation reporter(String reporter) {
|
||||||
if (isNotBlank(reporter)) {
|
if (isNotBlank(reporter)) {
|
||||||
options.put("-reporter", reporter);
|
options_.put("-reporter", reporter);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +697,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation shareThreadPoolForDataProviders(boolean shareThreadPoolForDataProviders) {
|
public TestNgOperation shareThreadPoolForDataProviders(boolean shareThreadPoolForDataProviders) {
|
||||||
if (shareThreadPoolForDataProviders) {
|
if (shareThreadPoolForDataProviders) {
|
||||||
options.put("-shareThreadPoolForDataProviders", String.valueOf(shareThreadPoolForDataProviders));
|
options_.put("-shareThreadPoolForDataProviders", "true");
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -581,10 +709,49 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*
|
*
|
||||||
* @param directory one or more directories
|
* @param directory one or more directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
* @see #sourceDir(String...) #sourceDir(String...)
|
* @see #sourceDir(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation sourceDir(String... directory) {
|
public TestNgOperation sourceDir(String... directory) {
|
||||||
options.put("-sourcedir", String.join(";", Arrays.stream(directory).filter(this::isNotBlank).toList()));
|
return sourceDir(List.of(directory));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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"}).
|
||||||
|
*
|
||||||
|
* @param directory one or more directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #sourceDirFiles(Collection)
|
||||||
|
*/
|
||||||
|
public TestNgOperation sourceDir(File... directory) {
|
||||||
|
return sourceDirFiles(List.of(directory));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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"}).
|
||||||
|
*
|
||||||
|
* @param directory one or more directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #sourceDirPaths(Collection)
|
||||||
|
*/
|
||||||
|
public TestNgOperation sourceDir(Path... directory) {
|
||||||
|
return sourceDirPaths(List.of(directory));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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"}).
|
||||||
|
*
|
||||||
|
* @param directory the list of directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #sourceDir(String...)
|
||||||
|
*/
|
||||||
|
public TestNgOperation sourceDir(Collection<String> directory) {
|
||||||
|
options_.put("-sourcedir", String.join(";", directory.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,11 +762,23 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*
|
*
|
||||||
* @param directory the list of directories
|
* @param directory the list of directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
* @see #sourceDir(String...) #sourceDir(String...)
|
* @see #sourceDir(File...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation sourceDir(Collection<String> directory) {
|
public TestNgOperation sourceDirFiles(Collection<File> directory) {
|
||||||
options.put("-sourcedir", String.join(";", directory.stream().filter(this::isNotBlank).toList()));
|
return sourceDir(directory.stream().map(File::getAbsolutePath).toList());
|
||||||
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"}).
|
||||||
|
*
|
||||||
|
* @param directory the list of directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #sourceDir(Path...)
|
||||||
|
*/
|
||||||
|
public TestNgOperation sourceDirPaths(Collection<Path> directory) {
|
||||||
|
return sourceDirFiles(directory.stream().map(Path::toFile).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -611,9 +790,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #spiListenersToSkip(Collection) #spiListenersToSkip(Collection)
|
* @see #spiListenersToSkip(Collection) #spiListenersToSkip(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation spiListenersToSkip(String... listenerToSkip) {
|
public TestNgOperation spiListenersToSkip(String... listenerToSkip) {
|
||||||
options.put("-spilistenerstoskip",
|
return spiListenersToSkip(List.of(listenerToSkip));
|
||||||
String.join(",", Arrays.stream(listenerToSkip).filter(this::isNotBlank).toList()));
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -625,7 +802,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #spiListenersToSkip(String...) #spiListenersToSkip(String...)
|
* @see #spiListenersToSkip(String...) #spiListenersToSkip(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation spiListenersToSkip(Collection<String> listenerToSkip) {
|
public TestNgOperation spiListenersToSkip(Collection<String> listenerToSkip) {
|
||||||
options.put("-spilistenerstoskip",
|
options_.put("-spilistenerstoskip",
|
||||||
String.join(",", listenerToSkip.stream().filter(this::isNotBlank).toList()));
|
String.join(",", listenerToSkip.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -639,7 +816,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation suiteName(String name) {
|
public TestNgOperation suiteName(String name) {
|
||||||
if (isNotBlank(name)) {
|
if (isNotBlank(name)) {
|
||||||
options.put("-suitename", '"' + name + '"');
|
options_.put("-suitename", '"' + name + '"');
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -653,7 +830,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation suiteThreadPoolSize(int poolSize) {
|
public TestNgOperation suiteThreadPoolSize(int poolSize) {
|
||||||
if (poolSize >= 0) {
|
if (poolSize >= 0) {
|
||||||
options.put("-suitethreadpoolsize", String.valueOf(poolSize));
|
options_.put("-suitethreadpoolsize", String.valueOf(poolSize));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -668,8 +845,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #suites(Collection) #suites(Collection)
|
* @see #suites(Collection) #suites(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation suites(String... suite) {
|
public TestNgOperation suites(String... suite) {
|
||||||
suites.addAll(Arrays.stream(suite).filter(this::isNotBlank).toList());
|
return suites(List.of(suite));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -682,10 +858,19 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #suites(String...) #suites(String...)
|
* @see #suites(String...) #suites(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation suites(Collection<String> suite) {
|
public TestNgOperation suites(Collection<String> suite) {
|
||||||
suites.addAll(suite.stream().filter(this::isNotBlank).toList());
|
suites_.addAll(suite.stream().filter(this::isNotBlank).toList());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the suites to run.
|
||||||
|
*
|
||||||
|
* @return the set of suites
|
||||||
|
*/
|
||||||
|
public Set<String> suites() {
|
||||||
|
return suites_;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a test file and delete it on exit.
|
* Create a test file and delete it on exit.
|
||||||
*
|
*
|
||||||
|
@ -707,8 +892,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #testClass(Collection) #testClass(Collection)
|
* @see #testClass(Collection) #testClass(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testClass(String... aClass) {
|
public TestNgOperation testClass(String... aClass) {
|
||||||
options.put("-testclass", String.join(",", Arrays.stream(aClass).filter(this::isNotBlank).toList()));
|
return testClass(List.of(aClass));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -721,7 +905,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #testClass(String...) #testClass(String...)
|
* @see #testClass(String...) #testClass(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testClass(Collection<String> aClass) {
|
public TestNgOperation testClass(Collection<String> aClass) {
|
||||||
options.put("-testclass", String.join(",", aClass.stream().filter(this::isNotBlank).toList()));
|
options_.put("-testclass", String.join(",", aClass.stream().filter(this::isNotBlank).toList()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,8 +917,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #testClasspath(String...) #testClasspath(String...)
|
* @see #testClasspath(String...) #testClasspath(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testClasspath(String... entry) {
|
public TestNgOperation testClasspath(String... entry) {
|
||||||
testClasspath.addAll(Arrays.stream(entry).filter(this::isNotBlank).toList());
|
return testClasspath(List.of(entry));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -745,10 +928,19 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #testClasspath(String...) #testClasspath(String...)
|
* @see #testClasspath(String...) #testClasspath(String...)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testClasspath(Collection<String> entry) {
|
public TestNgOperation testClasspath(Collection<String> entry) {
|
||||||
testClasspath.addAll(entry.stream().filter(this::isNotBlank).toList());
|
testClasspath_.addAll(entry.stream().filter(this::isNotBlank).toList());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the classpath entries used for running tests.
|
||||||
|
*
|
||||||
|
* @return the set of test classpath
|
||||||
|
*/
|
||||||
|
public Set<String> testClasspath() {
|
||||||
|
return testClasspath_;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a jar file that contains test classes. If a {@code testng.xml} file is found at the root of that
|
* 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
|
* jar file, it will be used, otherwise, all the test classes found in this jar file will be considered test
|
||||||
|
@ -759,7 +951,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testJar(String jar) {
|
public TestNgOperation testJar(String jar) {
|
||||||
if (isNotBlank(jar)) {
|
if (isNotBlank(jar)) {
|
||||||
options.put("-testjar", jar);
|
options_.put("-testjar", jar);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -773,7 +965,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testName(String name) {
|
public TestNgOperation testName(String name) {
|
||||||
if (isNotBlank(name)) {
|
if (isNotBlank(name)) {
|
||||||
options.put("-testname", '"' + name + '"');
|
options_.put("-testname", '"' + name + '"');
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -786,9 +978,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #testNames(Collection) #testNames(Collection)
|
* @see #testNames(Collection) #testNames(Collection)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testNames(String... name) {
|
public TestNgOperation testNames(String... name) {
|
||||||
options.put("-testnames",
|
return testNames(List.of(name));
|
||||||
Arrays.stream(name).filter(this::isNotBlank).map(s -> '"' + s + '"').collect(Collectors.joining(",")));
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -799,7 +989,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @see #testName(String) #testName(String)
|
* @see #testName(String) #testName(String)
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testNames(Collection<String> name) {
|
public TestNgOperation testNames(Collection<String> name) {
|
||||||
options.put("-testnames",
|
options_.put("-testnames",
|
||||||
name.stream().filter(this::isNotBlank).map(s -> '"' + s + '"').collect(Collectors.joining(",")));
|
name.stream().filter(this::isNotBlank).map(s -> '"' + s + '"').collect(Collectors.joining(",")));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -812,7 +1002,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation testRunFactory(String factory) {
|
public TestNgOperation testRunFactory(String factory) {
|
||||||
if (isNotBlank(factory)) {
|
if (isNotBlank(factory)) {
|
||||||
options.put("-testrunfactory", factory);
|
options_.put("-testrunfactory", factory);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -827,7 +1017,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation threadCount(int count) {
|
public TestNgOperation threadCount(int count) {
|
||||||
if (count >= 0) {
|
if (count >= 0) {
|
||||||
options.put("-threadcount", String.valueOf(count));
|
options_.put("-threadcount", String.valueOf(count));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -840,7 +1030,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation threadPoolFactoryClass(String factoryClass) {
|
public TestNgOperation threadPoolFactoryClass(String factoryClass) {
|
||||||
if (isNotBlank(factoryClass)) {
|
if (isNotBlank(factoryClass)) {
|
||||||
options.put("-threadpoolfactoryclass", factoryClass);
|
options_.put("-threadpoolfactoryclass", factoryClass);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -854,7 +1044,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public TestNgOperation useDefaultListeners(Boolean isDefaultListener) {
|
public TestNgOperation useDefaultListeners(Boolean isDefaultListener) {
|
||||||
options.put("-usedefaultlisteners", String.valueOf(isDefaultListener));
|
options_.put("-usedefaultlisteners", String.valueOf(isDefaultListener));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +1056,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation useGlobalThreadPool(boolean useGlobalThreadPool) {
|
public TestNgOperation useGlobalThreadPool(boolean useGlobalThreadPool) {
|
||||||
if (useGlobalThreadPool) {
|
if (useGlobalThreadPool) {
|
||||||
options.put("-useGlobalThreadPool", String.valueOf(useGlobalThreadPool));
|
options_.put("-useGlobalThreadPool", "true");
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -880,7 +1070,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation verbose(int level) {
|
public TestNgOperation verbose(int level) {
|
||||||
if (level >= 0) {
|
if (level >= 0) {
|
||||||
options.put("-verbose", String.valueOf(level));
|
options_.put("-verbose", String.valueOf(level));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -893,7 +1083,7 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
"<suite name=\"bld Default Suite\" verbose=\"2\">" +
|
"<suite name=\"bld Default Suite\" verbose=\"2\">" +
|
||||||
"<test name=\"All Packages\">" +
|
"<test name=\"All Packages\">" +
|
||||||
"<packages>");
|
"<packages>");
|
||||||
for (var p : packages) {
|
for (var p : packages_) {
|
||||||
bufWriter.write(String.format("<package name=\"%s\"/>", p));
|
bufWriter.write(String.format("<package name=\"%s\"/>", p));
|
||||||
}
|
}
|
||||||
bufWriter.write("</packages></test></suite>");
|
bufWriter.write("</packages></test></suite>");
|
||||||
|
@ -911,11 +1101,35 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
public TestNgOperation xmlPathInJar(String path) {
|
public TestNgOperation xmlPathInJar(String path) {
|
||||||
if (isNotBlank(path)) {
|
if (isNotBlank(path)) {
|
||||||
options.put("-xmlpathinjar", path);
|
options_.put("-xmlpathinjar", path);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This attribute should contain the path to a valid XML file inside the test jar
|
||||||
|
* (e.g. {@code "resources/testng.xml"}). The default is {@code testng.xml}, which means a file called
|
||||||
|
* {@code testng.xml} at the root of the jar file. This option will be ignored unless a test jar is specified.
|
||||||
|
*
|
||||||
|
* @param path the path
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public TestNgOperation xmlPathInJar(File path) {
|
||||||
|
return xmlPathInJar(path.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This attribute should contain the path to a valid XML file inside the test jar
|
||||||
|
* (e.g. {@code "resources/testng.xml"}). The default is {@code testng.xml}, which means a file called
|
||||||
|
* {@code testng.xml} at the root of the jar file. This option will be ignored unless a test jar is specified.
|
||||||
|
*
|
||||||
|
* @param path the path
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public TestNgOperation xmlPathInJar(Path path) {
|
||||||
|
return xmlPathInJar(path.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parallel Mechanisms
|
* Parallel Mechanisms
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -22,8 +22,9 @@ package rife.bld.extension;
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.TestClassWithoutTestCases")
|
@SuppressWarnings({"PMD.TestClassWithoutTestCases", "unused"})
|
||||||
class TestNgExample {
|
class TestNgExample {
|
||||||
|
@SuppressWarnings("SameReturnValue")
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return "Hello World!";
|
return "Hello World!";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -25,6 +25,7 @@ import org.testng.annotations.Test;
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
class TestNgExampleTest {
|
class TestNgExampleTest {
|
||||||
private final TestNgExample example = new TestNgExample();
|
private final TestNgExample example = new TestNgExample();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,10 +16,18 @@
|
||||||
|
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
|
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import rife.bld.Project; // NOPMD
|
import org.junit.jupiter.api.condition.EnabledOnOs;
|
||||||
|
import org.junit.jupiter.api.condition.OS;
|
||||||
|
import rife.bld.Project;
|
||||||
|
import rife.bld.blueprints.BaseProjectBlueprint;
|
||||||
import rife.bld.operations.exceptions.ExitStatusException;
|
import rife.bld.operations.exceptions.ExitStatusException;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
@ -38,47 +46,125 @@ class TestNgOperationTest {
|
||||||
@Test
|
@Test
|
||||||
void testAlwaysRunListeners() {
|
void testAlwaysRunListeners() {
|
||||||
var op = new TestNgOperation().alwaysRunListeners(false);
|
var op = new TestNgOperation().alwaysRunListeners(false);
|
||||||
assertThat(op.options.get("-alwaysrunlisteners")).isEqualTo("false");
|
assertThat(op.options().get("-alwaysrunlisteners")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().alwaysRunListeners(true);
|
op = new TestNgOperation().alwaysRunListeners(true);
|
||||||
assertThat(op.options.get("-alwaysrunlisteners")).isEqualTo("true");
|
assertThat(op.options().get("-alwaysrunlisteners")).isEqualTo("true");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnabledOnOs(OS.LINUX)
|
||||||
|
void testCheckAllParameters() throws IOException {
|
||||||
|
var args = Files.readAllLines(Paths.get("src", "test", "resources", "testng-args.txt"));
|
||||||
|
|
||||||
|
assertThat(args).isNotEmpty();
|
||||||
|
|
||||||
|
var params = new TestNgOperation()
|
||||||
|
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example", "examples", "Examples"))
|
||||||
|
.alwaysRunListeners(true)
|
||||||
|
.dataProviderThreadCount(1)
|
||||||
|
.dependencyInjectorFactory("injectorfactory")
|
||||||
|
.directory("dir")
|
||||||
|
.excludeGroups("group")
|
||||||
|
.failWhenEverythingSkipped(true)
|
||||||
|
.failurePolicy(TestNgOperation.FailurePolicy.SKIP)
|
||||||
|
.generateResultsPerSuite(true)
|
||||||
|
.groups("group1", "group2")
|
||||||
|
.ignoreMissedTestName(true)
|
||||||
|
.includeAllDataDrivenTestsWhenSkipping(true)
|
||||||
|
.listener("listener")
|
||||||
|
.listenerComparator("comparator")
|
||||||
|
.listenerFactory("factory")
|
||||||
|
.log(1)
|
||||||
|
.methodSelectors("selector")
|
||||||
|
.methods("methods")
|
||||||
|
.mixed(true)
|
||||||
|
.objectFactory("objectFactory")
|
||||||
|
.overrideIncludedMethods("method")
|
||||||
|
.parallel(TestNgOperation.Parallel.TESTS)
|
||||||
|
.propagateDataProviderFailureAsTestFailure(true)
|
||||||
|
.reporter("reporter")
|
||||||
|
.shareThreadPoolForDataProviders(true)
|
||||||
|
.spiListenersToSkip("listenter")
|
||||||
|
.suiteName("name")
|
||||||
|
.suiteThreadPoolSize(1)
|
||||||
|
.testClass("class")
|
||||||
|
.testJar("jar")
|
||||||
|
.testName("name")
|
||||||
|
.testNames("names")
|
||||||
|
.testRunFactory("runFactory")
|
||||||
|
.threadCount(1)
|
||||||
|
.threadPoolFactoryClass("poolClass")
|
||||||
|
.useDefaultListeners(true)
|
||||||
|
.useGlobalThreadPool(true)
|
||||||
|
.verbose(1)
|
||||||
|
.xmlPathInJar("jarPath")
|
||||||
|
.executeConstructProcessCommandList();
|
||||||
|
|
||||||
|
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||||
|
for (var p : args) {
|
||||||
|
var found = false;
|
||||||
|
for (var a : params) {
|
||||||
|
if (a.startsWith(p)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
softly.assertThat(found).as(p + " not found.").isTrue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testClass() {
|
void testClass() {
|
||||||
var op = new TestNgOperation().testClass(FOO, BAR);
|
var op = new TestNgOperation().testClass(FOO, BAR);
|
||||||
assertThat(op.options.get("-testclass")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(op.options().get("-testclass")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
new TestNgOperation().testClass(List.of(FOO, BAR));
|
new TestNgOperation().testClass(List.of(FOO, BAR));
|
||||||
assertThat(op.options.get("-testclass")).as("as list")
|
assertThat(op.options().get("-testclass")).as("as list")
|
||||||
.isEqualTo(String.format("%s,%s", FOO, BAR));
|
.isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testClasspath() {
|
||||||
|
var op = new TestNgOperation().testClasspath(FOO, BAR);
|
||||||
|
assertThat(op.testClasspath()).containsExactly(BAR, FOO);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDataProviderThreadCount() {
|
void testDataProviderThreadCount() {
|
||||||
var op = new TestNgOperation().dataProviderThreadCount(1);
|
var op = new TestNgOperation().dataProviderThreadCount(1);
|
||||||
assertThat(op.options.get("-dataproviderthreadcount")).isEqualTo("1");
|
assertThat(op.options().get("-dataproviderthreadcount")).isEqualTo("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDependencyInjectorFactory() {
|
void testDependencyInjectorFactory() {
|
||||||
var op = new TestNgOperation().dependencyInjectorFactory(FOO);
|
var op = new TestNgOperation().dependencyInjectorFactory(FOO);
|
||||||
assertThat(op.options.get("-dependencyinjectorfactory")).isEqualTo(FOO);
|
assertThat(op.options().get("-dependencyinjectorfactory")).isEqualTo(FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDirectory() {
|
void testDirectory() {
|
||||||
|
var foo = new File("FOO");
|
||||||
|
|
||||||
var op = new TestNgOperation().directory(FOO);
|
var op = new TestNgOperation().directory(FOO);
|
||||||
assertThat(op.options.get("-d")).isEqualTo(FOO);
|
assertThat(op.options().get("-d")).as("as string").isEqualTo(FOO);
|
||||||
|
|
||||||
|
op = new TestNgOperation().directory(foo);
|
||||||
|
assertThat(op.options().get("-d")).as("as file").isEqualTo(foo.getAbsolutePath());
|
||||||
|
|
||||||
|
op = new TestNgOperation().directory(foo.toPath());
|
||||||
|
assertThat(op.options().get("-d")).as("as path").isEqualTo(foo.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExcludeGroups() {
|
void testExcludeGroups() {
|
||||||
var op = new TestNgOperation().excludeGroups(FOO, BAR);
|
var op = new TestNgOperation().excludeGroups(FOO, BAR);
|
||||||
assertThat(op.options.get("-excludegroups")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(op.options().get("-excludegroups")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
op = new TestNgOperation().excludeGroups(List.of(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));
|
assertThat(op.options().get("-excludegroups")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -97,10 +183,9 @@ class TestNgOperationTest {
|
||||||
|
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
.testClass("rife.bld.extension.TestNgExampleTest")
|
.methods("rife.bld.extension.TestNgExampleTest.foo")
|
||||||
.methods("rife.bld.extension.TestNgExampleTest.verifyHello")
|
|
||||||
.execute())
|
.execute())
|
||||||
.as("with methods").doesNotThrowAnyException();
|
.as("with methods").isInstanceOf(ExitStatusException.class);
|
||||||
|
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
|
@ -135,276 +220,304 @@ class TestNgOperationTest {
|
||||||
@Test
|
@Test
|
||||||
void testFailWheneverEverythingSkipped() {
|
void testFailWheneverEverythingSkipped() {
|
||||||
var op = new TestNgOperation().failWhenEverythingSkipped(false);
|
var op = new TestNgOperation().failWhenEverythingSkipped(false);
|
||||||
assertThat(op.options.get("-failwheneverythingskipped")).isEqualTo("false");
|
assertThat(op.options().get("-failwheneverythingskipped")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().failWhenEverythingSkipped(true);
|
op = new TestNgOperation().failWhenEverythingSkipped(true);
|
||||||
assertThat(op.options.get("-failwheneverythingskipped")).isEqualTo("true");
|
assertThat(op.options().get("-failwheneverythingskipped")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testFailurePolicy() {
|
void testFailurePolicy() {
|
||||||
var op = new TestNgOperation().failurePolicy(TestNgOperation.FailurePolicy.CONTINUE);
|
var op = new TestNgOperation().failurePolicy(TestNgOperation.FailurePolicy.CONTINUE);
|
||||||
assertThat(op.options.get("-configfailurepolicy")).isEqualTo("continue");
|
assertThat(op.options().get("-configfailurepolicy")).isEqualTo("continue");
|
||||||
|
|
||||||
op = new TestNgOperation().failurePolicy(TestNgOperation.FailurePolicy.SKIP);
|
op = new TestNgOperation().failurePolicy(TestNgOperation.FailurePolicy.SKIP);
|
||||||
assertThat(op.options.get("-configfailurepolicy")).isEqualTo("skip");
|
assertThat(op.options().get("-configfailurepolicy")).isEqualTo("skip");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGenerateResultsPerSuite() {
|
void testGenerateResultsPerSuite() {
|
||||||
var op = new TestNgOperation().generateResultsPerSuite(false);
|
var op = new TestNgOperation().generateResultsPerSuite(false);
|
||||||
assertThat(op.options.get("-generateResultsPerSuite")).isEqualTo("false");
|
assertThat(op.options().get("-generateResultsPerSuite")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().generateResultsPerSuite(true);
|
op = new TestNgOperation().generateResultsPerSuite(true);
|
||||||
assertThat(op.options.get("-generateResultsPerSuite")).isEqualTo("true");
|
assertThat(op.options().get("-generateResultsPerSuite")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGroups() {
|
void testGroups() {
|
||||||
var op = new TestNgOperation().groups(FOO, BAR);
|
var op = new TestNgOperation().groups(FOO, BAR);
|
||||||
assertThat(op.options.get("-groups")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(op.options().get("-groups")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
|
op.groups(List.of("group3", "group4"));
|
||||||
|
assertThat(op.options().get("-groups")).isEqualTo("group3,group4");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testIgnoreMissedTestName() {
|
void testIgnoreMissedTestName() {
|
||||||
var op = new TestNgOperation().ignoreMissedTestName(false);
|
var op = new TestNgOperation().ignoreMissedTestName(false);
|
||||||
assertThat(op.options.get("-ignoreMissedTestNames")).isEqualTo("false");
|
assertThat(op.options().get("-ignoreMissedTestNames")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().ignoreMissedTestName(true);
|
op = new TestNgOperation().ignoreMissedTestName(true);
|
||||||
assertThat(op.options.get("-ignoreMissedTestNames")).isEqualTo("true");
|
assertThat(op.options().get("-ignoreMissedTestNames")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testIncludeAllDataDrivenTestsWhenSkipping() {
|
void testIncludeAllDataDrivenTestsWhenSkipping() {
|
||||||
var op = new TestNgOperation().includeAllDataDrivenTestsWhenSkipping(false);
|
var op = new TestNgOperation().includeAllDataDrivenTestsWhenSkipping(false);
|
||||||
assertThat(op.options.get("-includeAllDataDrivenTestsWhenSkipping")).isEqualTo("false");
|
assertThat(op.options().get("-includeAllDataDrivenTestsWhenSkipping")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().includeAllDataDrivenTestsWhenSkipping(true);
|
op = new TestNgOperation().includeAllDataDrivenTestsWhenSkipping(true);
|
||||||
assertThat(op.options.get("-includeAllDataDrivenTestsWhenSkipping")).isEqualTo("true");
|
assertThat(op.options().get("-includeAllDataDrivenTestsWhenSkipping")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJar() {
|
void testJar() {
|
||||||
var op = new TestNgOperation().testJar(FOO);
|
var op = new TestNgOperation().testJar(FOO);
|
||||||
assertThat(op.options.get("-testjar")).isEqualTo(FOO);
|
assertThat(op.options().get("-testjar")).isEqualTo(FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJunit() {
|
void testJunit() {
|
||||||
var op = new TestNgOperation().jUnit(false);
|
var op = new TestNgOperation().jUnit(false);
|
||||||
assertThat(op.options.get("-junit")).isEqualTo("false");
|
assertThat(op.options().get("-junit")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().jUnit(true);
|
op = new TestNgOperation().jUnit(true);
|
||||||
assertThat(op.options.get("-junit")).isEqualTo("true");
|
assertThat(op.options().get("-junit")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testListener() {
|
void testListener() {
|
||||||
var ops = new TestNgOperation().listener(FOO, BAR);
|
var ops = new TestNgOperation().listener(FOO, BAR);
|
||||||
assertThat(ops.options.get("-listener")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(ops.options().get("-listener")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
ops = new TestNgOperation().listener(List.of(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));
|
assertThat(ops.options().get("-listener")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMethodDetectors() {
|
void testMethodDetectors() {
|
||||||
var op = new TestNgOperation().methodSelectors(FOO, BAR);
|
var op = new TestNgOperation().methodSelectors(FOO, BAR);
|
||||||
assertThat(op.options.get("-methodselectors")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(op.options().get("-methodselectors")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
op = new TestNgOperation().methodSelectors(List.of(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));
|
assertThat(op.options().get("-methodselectors")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMethods() {
|
void testMethods() {
|
||||||
var op = new TestNgOperation().methods(FOO, BAR);
|
var op = new TestNgOperation().methods(FOO, BAR);
|
||||||
assertThat(op.options.get("-methods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(op.methods()).containsExactly(BAR, FOO);
|
||||||
|
|
||||||
new TestNgOperation().methods(List.of(FOO, BAR));
|
new TestNgOperation().methods(List.of(FOO, BAR));
|
||||||
assertThat(op.options.get("-methods")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(op.methods()).containsExactly(BAR, FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMixed() {
|
void testMixed() {
|
||||||
var op = new TestNgOperation().mixed(false);
|
var op = new TestNgOperation().mixed(false);
|
||||||
assertThat(op.options.get("-mixed")).isEqualTo("false");
|
assertThat(op.options().get("-mixed")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().mixed(true);
|
op = new TestNgOperation().mixed(true);
|
||||||
assertThat(op.options.get("-mixed")).isEqualTo("true");
|
assertThat(op.options().get("-mixed")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testName() {
|
void testName() {
|
||||||
var op = new TestNgOperation().testName(FOO);
|
var op = new TestNgOperation().testName(FOO);
|
||||||
assertThat(op.options.get("-testname")).isEqualTo("\"" + FOO + '\"');
|
assertThat(op.options().get("-testname")).isEqualTo("\"" + FOO + '\"');
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testNames() {
|
void testNames() {
|
||||||
var ops = new TestNgOperation().testNames(FOO, BAR);
|
var ops = new TestNgOperation().testNames(FOO, BAR);
|
||||||
assertThat(ops.options.get("-testnames")).isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
assertThat(ops.options().get("-testnames")).isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
||||||
|
|
||||||
new TestNgOperation().testNames(List.of(FOO, BAR));
|
new TestNgOperation().testNames(List.of(FOO, BAR));
|
||||||
assertThat(ops.options.get("-testnames")).as("as list").isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
assertThat(ops.options().get("-testnames")).as("as list").isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testObjectFactory() {
|
void testObjectFactory() {
|
||||||
var ops = new TestNgOperation().objectFactory(FOO, BAR);
|
var ops = new TestNgOperation().objectFactory(FOO, BAR);
|
||||||
assertThat(ops.options.get("-objectfactory")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(ops.options().get("-objectfactory")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
ops = new TestNgOperation().objectFactory(List.of(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));
|
assertThat(ops.options().get("-objectfactory")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testOverrideIncludedMethods() {
|
void testOverrideIncludedMethods() {
|
||||||
var ops = new TestNgOperation().overrideIncludedMethods(FOO, BAR);
|
var ops = new TestNgOperation().overrideIncludedMethods(FOO, BAR);
|
||||||
assertThat(ops.options.get("-overrideincludedmethods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(ops.options().get("-overrideincludedmethods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
ops = new TestNgOperation().overrideIncludedMethods(List.of(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));
|
assertThat(ops.options().get("-overrideincludedmethods")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPackages() {
|
void testPackages() {
|
||||||
var op = new TestNgOperation().packages(FOO, BAR);
|
var op = new TestNgOperation().packages(FOO, BAR);
|
||||||
assertThat(op.packages).contains(FOO).contains(BAR);
|
assertThat(op.packages()).contains(FOO).contains(BAR);
|
||||||
|
|
||||||
op = new TestNgOperation().packages(List.of(FOO, BAR));
|
op = new TestNgOperation().packages(List.of(FOO, BAR));
|
||||||
assertThat(op.packages).as("as list").contains(FOO).contains(BAR);
|
assertThat(op.packages()).as("as list").contains(FOO).contains(BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testParallel() {
|
void testParallel() {
|
||||||
var op = new TestNgOperation().parallel(TestNgOperation.Parallel.TESTS);
|
var op = new TestNgOperation().parallel(TestNgOperation.Parallel.TESTS);
|
||||||
assertThat(op.options.get("-parallel")).isEqualTo("tests");
|
assertThat(op.options().get("-parallel")).isEqualTo("tests");
|
||||||
|
|
||||||
op = new TestNgOperation().parallel(TestNgOperation.Parallel.METHODS);
|
op = new TestNgOperation().parallel(TestNgOperation.Parallel.METHODS);
|
||||||
assertThat(op.options.get("-parallel")).isEqualTo("methods");
|
assertThat(op.options().get("-parallel")).isEqualTo("methods");
|
||||||
|
|
||||||
op = new TestNgOperation().parallel(TestNgOperation.Parallel.CLASSES);
|
op = new TestNgOperation().parallel(TestNgOperation.Parallel.CLASSES);
|
||||||
assertThat(op.options.get("-parallel")).isEqualTo("classes");
|
assertThat(op.options().get("-parallel")).isEqualTo("classes");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPort() {
|
void testPort() {
|
||||||
var op = new TestNgOperation().port(1);
|
var op = new TestNgOperation().port(1);
|
||||||
assertThat(op.options.get("-port")).isEqualTo("1");
|
assertThat(op.options().get("-port")).isEqualTo("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPropagateDataProviderFailureAsTestFailure() {
|
void testPropagateDataProviderFailureAsTestFailure() {
|
||||||
var op = new TestNgOperation().propagateDataProviderFailureAsTestFailure(false);
|
var op = new TestNgOperation().propagateDataProviderFailureAsTestFailure(false);
|
||||||
assertThat(op.options.get("-propagateDataProviderFailureAsTestFailure")).isEqualTo("false");
|
assertThat(op.options().get("-propagateDataProviderFailureAsTestFailure")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().propagateDataProviderFailureAsTestFailure(true);
|
op = new TestNgOperation().propagateDataProviderFailureAsTestFailure(true);
|
||||||
assertThat(op.options.get("-propagateDataProviderFailureAsTestFailure")).isEqualTo("true");
|
assertThat(op.options().get("-propagateDataProviderFailureAsTestFailure")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testReported() {
|
void testReported() {
|
||||||
var op = new TestNgOperation().reporter(FOO);
|
var op = new TestNgOperation().reporter(FOO);
|
||||||
assertThat(op.options.get("-reporter")).isEqualTo(FOO);
|
assertThat(op.options().get("-reporter")).isEqualTo(FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRunFactory() {
|
void testRunFactory() {
|
||||||
var op = new TestNgOperation().testRunFactory(FOO);
|
var op = new TestNgOperation().testRunFactory(FOO);
|
||||||
assertThat(op.options.get("-testrunfactory")).isEqualTo(FOO);
|
assertThat(op.options().get("-testrunfactory")).isEqualTo(FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testShareThreadPoolForDataProviders() {
|
void testShareThreadPoolForDataProviders() {
|
||||||
var op = new TestNgOperation().shareThreadPoolForDataProviders(true);
|
var op = new TestNgOperation().shareThreadPoolForDataProviders(true);
|
||||||
assertThat(op.options.get("-shareThreadPoolForDataProviders")).isEqualTo("true");
|
assertThat(op.options().get("-shareThreadPoolForDataProviders")).isEqualTo("true");
|
||||||
|
|
||||||
op = new TestNgOperation().shareThreadPoolForDataProviders(false);
|
op = new TestNgOperation().shareThreadPoolForDataProviders(false);
|
||||||
assertThat(op.options.get("-shareThreadPoolForDataProviders")).isNull();
|
assertThat(op.options().get("-shareThreadPoolForDataProviders")).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSourceDir() {
|
void testSourceDir() {
|
||||||
|
var foo = new File(FOO);
|
||||||
|
var bar = new File(BAR);
|
||||||
|
|
||||||
|
var foobar = String.format("%s;%s", FOO, BAR);
|
||||||
var op = new TestNgOperation().sourceDir(FOO, BAR);
|
var op = new TestNgOperation().sourceDir(FOO, BAR);
|
||||||
assertThat(op.options.get("-sourcedir")).isEqualTo(String.format("%s;%s", FOO, BAR));
|
assertThat(op.options().get("-sourcedir")).as("String...").isEqualTo(foobar);
|
||||||
|
|
||||||
op = new TestNgOperation().sourceDir(List.of(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));
|
assertThat(op.options().get("-sourcedir")).as("List(String...)").isEqualTo(foobar);
|
||||||
|
|
||||||
|
foobar = String.format("%s;%s", foo.getAbsolutePath(), bar.getAbsolutePath());
|
||||||
|
op = new TestNgOperation().sourceDir(foo, bar);
|
||||||
|
assertThat(op.options().get("-sourcedir")).as("File...").isEqualTo(foobar);
|
||||||
|
|
||||||
|
op = new TestNgOperation().sourceDirFiles(List.of(foo, bar));
|
||||||
|
assertThat(op.options().get("-sourcedir")).as("List(String...)").isEqualTo(foobar);
|
||||||
|
|
||||||
|
op = new TestNgOperation().sourceDir(foo.toPath(), bar.toPath());
|
||||||
|
assertThat(op.options().get("-sourcedir")).as("Path...").isEqualTo(foobar);
|
||||||
|
|
||||||
|
op = new TestNgOperation().sourceDirPaths(List.of(foo.toPath(), bar.toPath()));
|
||||||
|
assertThat(op.options().get("-sourcedir")).as("List(Path...)").isEqualTo(foobar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSpiListenersToSkip() {
|
void testSpiListenersToSkip() {
|
||||||
var ops = new TestNgOperation().spiListenersToSkip(FOO, BAR);
|
var ops = new TestNgOperation().spiListenersToSkip(FOO, BAR);
|
||||||
assertThat(ops.options.get("-spilistenerstoskip")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
assertThat(ops.options().get("-spilistenerstoskip")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
|
|
||||||
ops = new TestNgOperation().spiListenersToSkip(List.of(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));
|
assertThat(ops.options().get("-spilistenerstoskip")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuiteName() {
|
void testSuiteName() {
|
||||||
var op = new TestNgOperation().suiteName(FOO);
|
var op = new TestNgOperation().suiteName(FOO);
|
||||||
assertThat(op.options.get("-suitename")).isEqualTo("\"" + FOO + '\"');
|
assertThat(op.options().get("-suitename")).isEqualTo("\"" + FOO + '\"');
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuiteThreadPoolSize() {
|
void testSuiteThreadPoolSize() {
|
||||||
var op = new TestNgOperation().suiteThreadPoolSize(1);
|
var op = new TestNgOperation().suiteThreadPoolSize(1);
|
||||||
assertThat(op.options.get("-suitethreadpoolsize")).isEqualTo("1");
|
assertThat(op.options().get("-suitethreadpoolsize")).isEqualTo("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuites() {
|
void testSuites() {
|
||||||
var op = new TestNgOperation().suites(FOO, BAR);
|
var op = new TestNgOperation().suites(FOO, BAR);
|
||||||
assertThat(op.suites).contains(FOO).contains(BAR);
|
assertThat(op.suites()).contains(FOO).contains(BAR);
|
||||||
|
|
||||||
op = new TestNgOperation().suites(List.of(FOO, BAR));
|
op = new TestNgOperation().suites(List.of(FOO, BAR));
|
||||||
assertThat(op.suites).as("as list").contains(FOO).contains(BAR);
|
assertThat(op.suites()).as("as list").contains(FOO).contains(BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testThreadCount() {
|
void testThreadCount() {
|
||||||
var op = new TestNgOperation().threadCount(1);
|
var op = new TestNgOperation().threadCount(1);
|
||||||
assertThat(op.options.get("-threadcount")).isEqualTo("1");
|
assertThat(op.options().get("-threadcount")).isEqualTo("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testThreadPoolFactoryClass() {
|
void testThreadPoolFactoryClass() {
|
||||||
var op = new TestNgOperation().threadPoolFactoryClass(FOO);
|
var op = new TestNgOperation().threadPoolFactoryClass(FOO);
|
||||||
assertThat(op.options.get("-threadpoolfactoryclass")).isEqualTo(FOO);
|
assertThat(op.options().get("-threadpoolfactoryclass")).isEqualTo(FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testUseDefaultListeners() {
|
void testUseDefaultListeners() {
|
||||||
var op = new TestNgOperation().useDefaultListeners(false);
|
var op = new TestNgOperation().useDefaultListeners(false);
|
||||||
assertThat(op.options.get("-usedefaultlisteners")).isEqualTo("false");
|
assertThat(op.options().get("-usedefaultlisteners")).isEqualTo("false");
|
||||||
|
|
||||||
op = new TestNgOperation().useDefaultListeners(true);
|
op = new TestNgOperation().useDefaultListeners(true);
|
||||||
assertThat(op.options.get("-usedefaultlisteners")).isEqualTo("true");
|
assertThat(op.options().get("-usedefaultlisteners")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testUseGlobalThreadPool() {
|
void testUseGlobalThreadPool() {
|
||||||
var op = new TestNgOperation().useGlobalThreadPool(true);
|
var op = new TestNgOperation().useGlobalThreadPool(true);
|
||||||
assertThat(op.options.get("-useGlobalThreadPool")).isEqualTo("true");
|
assertThat(op.options().get("-useGlobalThreadPool")).isEqualTo("true");
|
||||||
|
|
||||||
op = new TestNgOperation().useGlobalThreadPool(false);
|
op = new TestNgOperation().useGlobalThreadPool(false);
|
||||||
assertThat(op.options.get("-useGlobalThreadPool")).isNull();
|
assertThat(op.options().get("-useGlobalThreadPool")).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testVerbose() {
|
void testVerbose() {
|
||||||
var op = new TestNgOperation().log(1);
|
var op = new TestNgOperation().log(1);
|
||||||
assertThat(op.options.get("-log")).isEqualTo("1");
|
assertThat(op.options().get("-log")).isEqualTo("1");
|
||||||
|
|
||||||
op = new TestNgOperation().verbose(1);
|
op = new TestNgOperation().verbose(1);
|
||||||
assertThat(op.options.get("-verbose")).isEqualTo("1");
|
assertThat(op.options().get("-verbose")).isEqualTo("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testXmlPathInJar() {
|
void testXmlPathInJar() {
|
||||||
|
var foo = new File(FOO);
|
||||||
var op = new TestNgOperation().xmlPathInJar(FOO);
|
var op = new TestNgOperation().xmlPathInJar(FOO);
|
||||||
assertThat(op.options.get("-xmlpathinjar")).isEqualTo(FOO);
|
assertThat(op.options().get("-xmlpathinjar")).as("as string").isEqualTo(FOO);
|
||||||
|
|
||||||
|
op = new TestNgOperation().xmlPathInJar(foo);
|
||||||
|
assertThat(op.options().get("-xmlpathinjar")).as("as file").isEqualTo(foo.getAbsolutePath());
|
||||||
|
|
||||||
|
op = new TestNgOperation().xmlPathInJar(foo.toPath());
|
||||||
|
assertThat(op.options().get("-xmlpathinjar")).as("as path").isEqualTo(foo.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
38
src/test/resources/testng-args.txt
Normal file
38
src/test/resources/testng-args.txt
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
-alwaysrunlisteners
|
||||||
|
-configfailurepolicy
|
||||||
|
-d
|
||||||
|
-dataproviderthreadcount
|
||||||
|
-dependencyinjectorfactory
|
||||||
|
-excludegroups
|
||||||
|
-failwheneverythingskipped
|
||||||
|
-generateResultsPerSuite
|
||||||
|
-groups
|
||||||
|
-ignoreMissedTestNames
|
||||||
|
-includeAllDataDrivenTestsWhenSkipping
|
||||||
|
-listener
|
||||||
|
-listenercomparator
|
||||||
|
-listenerfactory
|
||||||
|
-log
|
||||||
|
-methods
|
||||||
|
-methodselectors
|
||||||
|
-mixed
|
||||||
|
-objectfactory
|
||||||
|
-overrideincludedmethods
|
||||||
|
-parallel
|
||||||
|
-propagateDataProviderFailureAsTestFailure
|
||||||
|
-reporter
|
||||||
|
-shareThreadPoolForDataProviders
|
||||||
|
-spilistenerstoskip
|
||||||
|
-suitename
|
||||||
|
-suitethreadpoolsize
|
||||||
|
-testclass
|
||||||
|
-testjar
|
||||||
|
-testname
|
||||||
|
-testnames
|
||||||
|
-testrunfactory
|
||||||
|
-threadcount
|
||||||
|
-threadpoolfactoryclass
|
||||||
|
-usedefaultlisteners
|
||||||
|
-useGlobalThreadPool
|
||||||
|
-verbose
|
||||||
|
-xmlpathinjar
|
|
@ -3,6 +3,10 @@
|
||||||
<test name="simple test">
|
<test name="simple test">
|
||||||
<classes>
|
<classes>
|
||||||
<class name="rife.bld.extension.TestNgExample"/>
|
<class name="rife.bld.extension.TestNgExample"/>
|
||||||
|
<methods>
|
||||||
|
<exclude name="foo"/>
|
||||||
|
</methods>
|
||||||
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
</test>
|
</test>
|
||||||
</suite>
|
</suite>
|
Loading…
Add table
Add a link
Reference in a new issue