Compare commits
78 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 | |||
75b33ba6d6 | |||
c8fe28cda9 | |||
e26934ef67 | |||
47e23dc23c | |||
ef4a259a33 | |||
e32abb231b | |||
428dfd1a2d | |||
1074e12b9b | |||
402e9d9025 | |||
dd196cd761 | |||
100ce6dc0d | |||
f92ab27463 | |||
b69faf34d6 |
45 changed files with 1564 additions and 409 deletions
29
.github/workflows/bld.yml
vendored
29
.github/workflows/bld.yml
vendored
|
@ -4,29 +4,36 @@ on: [ push, pull_request, workflow_dispatch ]
|
|||
|
||||
jobs:
|
||||
build-bld-project:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
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:
|
||||
- name: Checkout source repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK ${{ matrix.java-version }}
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
distribution: "zulu"
|
||||
java-version: ${{ matrix.java-version }}
|
||||
|
||||
- name: Grant execute permission for bld
|
||||
run: chmod +x bld
|
||||
|
||||
- name: Download the dependencies
|
||||
- name: Download dependencies [examples]
|
||||
working-directory: examples
|
||||
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
|
12
.github/workflows/pages.yml
vendored
12
.github/workflows/pages.yml
vendored
|
@ -30,14 +30,14 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout source repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
distribution: "zulu"
|
||||
java-version: 17
|
||||
|
||||
- name: Build Javadocs
|
||||
|
@ -47,11 +47,11 @@ jobs:
|
|||
uses: actions/configure-pages@v3
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
# Upload generated Javadocs repository
|
||||
path: 'build/javadoc/'
|
||||
path: "build/javadoc/"
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
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
|
||||
|
||||
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">
|
||||
<copyright>
|
||||
<option name="notice" value=" Copyright &#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||
<option name="notice" value="Copyright 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" />
|
||||
</copyright>
|
||||
</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 |
204
.idea/intellij-javadocs-4.0.1.xml
generated
Normal file
204
.idea/intellij-javadocs-4.0.1.xml
generated
Normal file
|
@ -0,0 +1,204 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaDocConfiguration">
|
||||
<GENERAL>
|
||||
<MODE>UPDATE</MODE>
|
||||
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
||||
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
||||
<LEVELS>
|
||||
<LEVEL>TYPE</LEVEL>
|
||||
<LEVEL>METHOD</LEVEL>
|
||||
<LEVEL>FIELD</LEVEL>
|
||||
</LEVELS>
|
||||
<VISIBILITIES>
|
||||
<VISIBILITY>PROTECTED</VISIBILITY>
|
||||
<VISIBILITY>DEFAULT</VISIBILITY>
|
||||
<VISIBILITY>PUBLIC</VISIBILITY>
|
||||
</VISIBILITIES>
|
||||
</GENERAL>
|
||||
<TEMPLATES>
|
||||
<CLASSES>
|
||||
<CLASS>
|
||||
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
||||
<VALUE>/**\n
|
||||
* The interface ${name}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
<CLASS>
|
||||
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
||||
<VALUE>/**\n
|
||||
* The enum ${name}.\n
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
<CLASS>
|
||||
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
||||
<VALUE>/**\n
|
||||
* The type ${name}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
<CLASS>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* The type ${name}.\n
|
||||
*/</VALUE>
|
||||
</CLASS>
|
||||
</CLASSES>
|
||||
<CONSTRUCTORS>
|
||||
<CONSTRUCTOR>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* Instantiates a new ${name}.\n
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</CONSTRUCTOR>
|
||||
</CONSTRUCTORS>
|
||||
<METHODS>
|
||||
<METHOD>
|
||||
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
||||
<VALUE>/**\n
|
||||
* Gets ${partName}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if isNotVoid>
|
||||
*\n
|
||||
* @return the ${partName}\n
|
||||
</#if>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
<METHOD>
|
||||
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
||||
<VALUE>/**\n
|
||||
* Sets ${partName}.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if isNotVoid>
|
||||
*\n
|
||||
* @return the ${partName}\n
|
||||
</#if>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
<METHOD>
|
||||
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
||||
<VALUE>/**\n
|
||||
* The entry point of application.\n
|
||||
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
<METHOD>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
||||
<#if element.typeParameters?has_content> * \n
|
||||
</#if>
|
||||
<#list element.typeParameters as typeParameter>
|
||||
* @param <${typeParameter.name}> the type parameter\n
|
||||
</#list>
|
||||
<#if element.parameterList.parameters?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.parameterList.parameters as parameter>
|
||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||
</#list>
|
||||
<#if isNotVoid>
|
||||
*\n
|
||||
* @return the ${return}\n
|
||||
</#if>
|
||||
<#if element.throwsList.referenceElements?has_content>
|
||||
*\n
|
||||
</#if>
|
||||
<#list element.throwsList.referenceElements as exception>
|
||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||
</#list>
|
||||
*/</VALUE>
|
||||
</METHOD>
|
||||
</METHODS>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
||||
<VALUE>/**\n
|
||||
* The constant ${element.getName()}.\n
|
||||
*/</VALUE>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
||||
<VALUE>/**\n
|
||||
<#if element.parent.isInterface()>
|
||||
* The constant ${element.getName()}.\n
|
||||
<#else>
|
||||
* The ${name}.\n
|
||||
</#if> */</VALUE>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<KEY>.+</KEY>
|
||||
<VALUE>/**\n
|
||||
<#if element.parent.isEnum()>
|
||||
*${name} ${typeName}.\n
|
||||
<#else>
|
||||
* The ${name}.\n
|
||||
</#if>*/</VALUE>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</TEMPLATES>
|
||||
</component>
|
||||
</project>
|
5
.idea/libraries/bld.xml
generated
5
.idea/libraries/bld.xml
generated
|
@ -2,11 +2,12 @@
|
|||
<library name="bld">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
<excluded>
|
||||
<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>
|
||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
||||
</library>
|
||||
</component>
|
4
.idea/libraries/runtime.xml
generated
4
.idea/libraries/runtime.xml
generated
|
@ -8,7 +8,7 @@
|
|||
<SOURCES>
|
||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
||||
</library>
|
||||
</component>
|
4
.idea/libraries/test.xml
generated
4
.idea/libraries/test.xml
generated
|
@ -8,7 +8,7 @@
|
|||
<SOURCES>
|
||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
||||
</library>
|
||||
</component>
|
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<pattern value="rife.bld.extension.TestNgOperationBuild" method="pmd" />
|
||||
|
@ -8,7 +9,7 @@
|
|||
<component name="PDMPlugin">
|
||||
<option name="customRuleSets">
|
||||
<list>
|
||||
<option value="K:\java\semver\config\pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/config/pmd.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="skipTestSources" value="false" />
|
||||
|
|
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
|
@ -5,7 +5,14 @@
|
|||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "rife.bld.extension.TestNgOperationTest"
|
||||
"mainClass": "org.junit.platform.console.ConsoleLauncher",
|
||||
"args": [
|
||||
"--details=verbose",
|
||||
"--scan-classpath",
|
||||
"--disable-banner",
|
||||
"--disable-ansi-colors",
|
||||
"--exclude-engine=junit-platform-suite",
|
||||
"--exclude-engine=junit-vintage"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
@ -3,13 +3,13 @@
|
|||
"src/main/java",
|
||||
"src/main/resources",
|
||||
"src/test/java",
|
||||
"src/bld/java"
|
||||
"src/test/resources",
|
||||
"src/bld/java",
|
||||
"src/bld/resources"
|
||||
],
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}bld-1.7.1.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
"lib/test/*.jar"
|
||||
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
||||
|
|
53
README.md
53
README.md
|
@ -1,55 +1,46 @@
|
|||
# [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://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/#/snapshots/com/uwyn/rife2/bld-testng)
|
||||
[](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:
|
||||
|
||||
```java
|
||||
@BuildCommand(summary = "Tests the project with TestNG")
|
||||
public void testng() throws Exception {
|
||||
new TestNgOperation()
|
||||
.fromProject(this)
|
||||
.packages("com.example")
|
||||
.execute();
|
||||
@Override
|
||||
public TestOperation<?, ?> testOperation() {
|
||||
return new TestNgOperation()
|
||||
.fromProject(this)
|
||||
.packages("com.example");
|
||||
}
|
||||
```
|
||||
|
||||
```text
|
||||
./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();
|
||||
}
|
||||
```
|
||||
```
|
||||
```console
|
||||
./bld compile test
|
||||
```
|
||||
|
||||
- [View Examples Project](https://github.com/rife2/bld-testng/tree/master/examples)
|
||||
|
||||
Please check the [TestNgOperation documentation](https://rife2.github.io/bld-testng/rife/bld/extension/TestNgOperation.html#method-summary) for all available configuration options.
|
||||
|
||||
### TestNG Dependency
|
||||
|
||||
Don't forget to add a TestNG test dependency to your build file, as it is not provided by the extension. For example:
|
||||
Don't forget to add a TestNG `test` dependency to your build file, as it is not provided by the extension. For example:
|
||||
|
||||
```java
|
||||
repositories = List.of(MAVEN_CENTRAL);
|
||||
scope(test).include(dependency("org.testng", "testng", version(7, 8, 0)));
|
||||
|
||||
```
|
||||
scope(test).include(dependency("org.testng", "testng", version(7, 11, 0)));
|
||||
```
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<!-- BEST PRACTICES -->
|
||||
<rule ref="category/java/bestpractices.xml">
|
||||
<exclude name="AvoidPrintStackTrace"/>
|
||||
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
|
||||
<exclude name="JUnitTestContainsTooManyAsserts"/>
|
||||
<exclude name="GuardLogStatement"/>
|
||||
<exclude name="UnitTestContainsTooManyAsserts"/>
|
||||
<exclude name="UnitTestShouldUseTestAnnotation"/>
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
||||
|
@ -24,8 +24,8 @@
|
|||
<rule ref="category/java/codestyle.xml">
|
||||
<exclude name="AtLeastOneConstructor"/>
|
||||
<exclude name="ClassNamingConventions"/>
|
||||
<exclude name="ConfusingTernary"/>
|
||||
<exclude name="CommentDefaultAccessModifier"/>
|
||||
<exclude name="ConfusingTernary"/>
|
||||
<exclude name="FieldNamingConventions"/>
|
||||
<exclude name="LocalVariableCouldBeFinal"/>
|
||||
<exclude name="LongVariable"/>
|
||||
|
@ -35,8 +35,9 @@
|
|||
<exclude name="ShortClassName"/>
|
||||
<exclude name="ShortMethodName"/>
|
||||
<exclude name="ShortVariable"/>
|
||||
<exclude name="UselessParentheses"/>
|
||||
<exclude name="UseExplicitTypes"/>
|
||||
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||
<exclude name="UselessParentheses"/>
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
||||
|
@ -52,8 +53,6 @@
|
|||
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
||||
<exclude name="CognitiveComplexity"/>
|
||||
<exclude name="CyclomaticComplexity"/>
|
||||
<exclude name="ExcessiveClassLength"/>
|
||||
<exclude name="ExcessiveMethodLength"/>
|
||||
<exclude name="ExcessiveParameterList"/>
|
||||
<exclude name="ExcessivePublicCount"/>
|
||||
<exclude name="GodClass"/>
|
||||
|
@ -107,4 +106,4 @@
|
|||
<!-- SECURITY -->
|
||||
<rule ref="category/java/security.xml">
|
||||
</rule>
|
||||
</ruleset>
|
||||
</ruleset>
|
||||
|
|
1
examples/.idea/.name
generated
Normal file
1
examples/.idea/.name
generated
Normal file
|
@ -0,0 +1 @@
|
|||
bld-testng-examples
|
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>
|
5
examples/.idea/libraries/bld.xml
generated
5
examples/.idea/libraries/bld.xml
generated
|
@ -2,11 +2,12 @@
|
|||
<library name="bld">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
<excluded>
|
||||
<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>
|
||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
||||
</library>
|
||||
</component>
|
4
examples/.idea/libraries/runtime.xml
generated
4
examples/.idea/libraries/runtime.xml
generated
|
@ -8,7 +8,7 @@
|
|||
<SOURCES>
|
||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
||||
</library>
|
||||
</component>
|
4
examples/.idea/libraries/test.xml
generated
4
examples/.idea/libraries/test.xml
generated
|
@ -8,7 +8,7 @@
|
|||
<SOURCES>
|
||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
||||
</library>
|
||||
</component>
|
4
examples/.idea/misc.xml
generated
4
examples/.idea/misc.xml
generated
|
@ -3,6 +3,10 @@
|
|||
<component name="EntryPointsManager">
|
||||
<pattern value="com.example.ExamplesBuild" method="testng" />
|
||||
<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 name="PDMPlugin">
|
||||
<option name="customRuleSets">
|
||||
|
|
5
examples/.vscode/launch.json
vendored
5
examples/.vscode/launch.json
vendored
|
@ -5,7 +5,10 @@
|
|||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "com.example.ExamplesTest"
|
||||
"mainClass": "com.example.ExamplesBuild",
|
||||
"args": [
|
||||
"compile", "test"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
11
examples/.vscode/settings.json
vendored
11
examples/.vscode/settings.json
vendored
|
@ -3,13 +3,14 @@
|
|||
"src/main/java",
|
||||
"src/main/resources",
|
||||
"src/test/java",
|
||||
"src/bld/java"
|
||||
"src/test/resources",
|
||||
"src/bld/java",
|
||||
"src/bld/resources",
|
||||
"src/bld/resources"
|
||||
],
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.project.referencedLibraries": [
|
||||
"${HOME}bld-1.7.2.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
"lib/test/*.jar"
|
||||
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
||||
|
|
11
examples/README.md
Normal file
11
examples/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
Compile and Run Tests with TestNG
|
||||
|
||||
```console
|
||||
./bld compile test
|
||||
```
|
||||
|
||||
Compile and Generate JaCoCo Reports
|
||||
|
||||
```console
|
||||
./bld compile jacoco
|
||||
```
|
Binary file not shown.
|
@ -1,7 +1,8 @@
|
|||
bld.downloadExtensionJavadoc=false
|
||||
bld.downloadExtensionSources=true
|
||||
bld.extensions=com.uwyn.rife2:bld-testng:0.9.1
|
||||
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||
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.version=1.7.2
|
||||
bld.version=2.2.1
|
||||
|
|
|
@ -2,9 +2,14 @@ package com.example;
|
|||
|
||||
import rife.bld.BaseProject;
|
||||
import rife.bld.BuildCommand;
|
||||
import rife.bld.extension.JacocoReportOperation;
|
||||
import rife.bld.extension.TestNgOperation;
|
||||
import rife.bld.operations.TestOperation;
|
||||
|
||||
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.Scope.test;
|
||||
|
@ -12,9 +17,10 @@ import static rife.bld.dependencies.Scope.test;
|
|||
/**
|
||||
* Example build.
|
||||
*
|
||||
* <ul style="list-style-type:none">
|
||||
* <li>./bld compile test</li>
|
||||
* </ul>
|
||||
* <pre>{@code
|
||||
* ./bld compile test
|
||||
* ./bld compile jacoco
|
||||
* }</pre>
|
||||
*/
|
||||
public class ExamplesBuild extends BaseProject {
|
||||
public ExamplesBuild() {
|
||||
|
@ -22,19 +28,41 @@ public class ExamplesBuild extends BaseProject {
|
|||
name = "Examples";
|
||||
version = version(0, 1, 0);
|
||||
|
||||
javaRelease = 17;
|
||||
|
||||
downloadSources = true;
|
||||
autoDownloadPurge = true;
|
||||
|
||||
repositories = List.of(MAVEN_CENTRAL);
|
||||
scope(test).include(dependency("org.testng", "testng", version(7, 8, 0)));
|
||||
|
||||
scope(test).include(dependency("org.testng", "testng", version(7, 11, 0)));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Tests the project with TestNG")
|
||||
public void test() throws Exception {
|
||||
new TestNgOperation()
|
||||
@BuildCommand(summary = "Generates Jacoco Reports")
|
||||
public void jacoco() throws Exception {
|
||||
new JacocoReportOperation()
|
||||
.fromProject(this)
|
||||
.packages("com.example")
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestOperation<?, ?> testOperation() {
|
||||
return new TestNgOperation()
|
||||
.fromProject(this)
|
||||
.packages("com.example");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,16 @@ package com.example;
|
|||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
class ExampleTest {
|
||||
public static void main(String[] args) {
|
||||
new ExampleTest().verifyHello();
|
||||
}
|
||||
class ExamplesTest {
|
||||
private final ExamplesLib example = new ExamplesLib();
|
||||
|
||||
@Test
|
||||
void testFail() {
|
||||
Assert.fail("failed");
|
||||
void foo() {
|
||||
Assert.assertNotEquals(example.getMessage(), "foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyHello() {
|
||||
Assert.assertTrue(true);
|
||||
Assert.assertEquals(example.getMessage(), "Hello World!");
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
|||
bld.downloadExtensionJavadoc=false
|
||||
bld.downloadExtensionSources=true
|
||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
|
||||
bld.extension-generated-version=com.uwyn.rife2:bld-generated-version:0.9.1
|
||||
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||
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.version=1.7.2
|
||||
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,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
@ -24,8 +24,7 @@ import rife.bld.publish.PublishScm;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
|
||||
import static rife.bld.dependencies.Repository.*;
|
||||
import static rife.bld.dependencies.Scope.compile;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||
|
@ -34,44 +33,54 @@ public class TestNgOperationBuild extends Project {
|
|||
public TestNgOperationBuild() {
|
||||
pkg = "rife.bld.extension";
|
||||
name = "bld-testng";
|
||||
version = version(0, 9, 1);
|
||||
version = version(1, 0, 3, "SNAPSHOT");
|
||||
|
||||
javaRelease = 17;
|
||||
|
||||
downloadSources = true;
|
||||
autoDownloadPurge = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
||||
|
||||
var rife2 = version(1, 7, 0);
|
||||
scope(compile)
|
||||
.include(dependency("com.uwyn.rife2", "rife2", rife2))
|
||||
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 2)));
|
||||
.include(dependency("com.uwyn.rife2", "bld", version(2, 2, 1)));
|
||||
|
||||
scope(test)
|
||||
.include(dependency("org.testng", "testng", version(7, 8, 0)))
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
|
||||
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
||||
.include(dependency("org.testng", "testng", version(7, 11, 0)))
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1)))
|
||||
.include(dependency("org.assertj", "assertj-core", version(3, 27, 3)));
|
||||
|
||||
javadocOperation()
|
||||
.javadocOptions()
|
||||
.author()
|
||||
.docLint(NO_MISSING)
|
||||
.link("https://rife2.github.io/bld/")
|
||||
.link("https://rife2.github.io/rife2/");
|
||||
|
||||
publishOperation()
|
||||
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
|
||||
.repository(repository("github"))
|
||||
.info()
|
||||
.groupId("com.uwyn.rife2")
|
||||
.artifactId("bld-testng")
|
||||
.description("bld Extension to execute tests with TestNG")
|
||||
.url("https://github.com/rife2/bld-testng")
|
||||
.developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net")
|
||||
.url("https://erik.thauvin.net/"))
|
||||
.license(new PublishLicense().name("The Apache License, Version 2.0")
|
||||
.url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
|
||||
.scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-testng.git")
|
||||
.developer(new PublishDeveloper()
|
||||
.id("ethauvin")
|
||||
.name("Erik C. Thauvin")
|
||||
.email("erik@thauvin.net")
|
||||
.url("https://erik.thauvin.net/")
|
||||
)
|
||||
.license(new PublishLicense()
|
||||
.name("The Apache License, Version 2.0")
|
||||
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
)
|
||||
.scm(new PublishScm()
|
||||
.connection("scm:git:https://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")
|
||||
)
|
||||
.signKey(property("sign.key"))
|
||||
.signPassphrase(property("sign.passphrase"));
|
||||
}
|
||||
|
@ -88,4 +97,16 @@ public class TestNgOperationBuild extends Project {
|
|||
.ruleSets("config/pmd.xml")
|
||||
.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();
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
31
src/test/java/rife/bld/extension/TestNgExample.java
Normal file
31
src/test/java/rife/bld/extension/TestNgExample.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright 2023-2025 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.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
||||
/**
|
||||
* Implements the TestNgExample class.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
@SuppressWarnings({"PMD.TestClassWithoutTestCases", "unused"})
|
||||
class TestNgExample {
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
public String getMessage() {
|
||||
return "Hello World!";
|
||||
}
|
||||
}
|
41
src/test/java/rife/bld/extension/TestNgExampleTest.java
Normal file
41
src/test/java/rife/bld/extension/TestNgExampleTest.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright 2023-2025 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.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Implements the TestNgExampleTest class.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
class TestNgExampleTest {
|
||||
private final TestNgExample example = new TestNgExample();
|
||||
|
||||
@Test
|
||||
void foo() {
|
||||
Assert.assertEquals(example.getMessage(), "foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyHello() {
|
||||
Assert.assertEquals(example.getMessage(), "Hello World!");
|
||||
}
|
||||
}
|
|
@ -1,25 +1,35 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
* Copyright 2023-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
||||
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
||||
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 java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
/**
|
||||
|
@ -36,47 +46,132 @@ class TestNgOperationTest {
|
|||
@Test
|
||||
void testAlwaysRunListeners() {
|
||||
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);
|
||||
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
|
||||
void testClass() {
|
||||
var op = new TestNgOperation().testClass(FOO, BAR);
|
||||
assertThat(op.options.get(TestNgOperation.TEST_CLASS_ARG)).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));
|
||||
assertThat(op.options().get("-testclass")).as("as list")
|
||||
.isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testClasspath() {
|
||||
var op = new TestNgOperation().testClasspath(FOO, BAR);
|
||||
assertThat(op.testClasspath()).containsExactly(BAR, FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDataProviderThreadCount() {
|
||||
var op = new TestNgOperation().dataProviderThreadCount(1);
|
||||
assertThat(op.options.get("-dataproviderthreadcount")).isEqualTo("1");
|
||||
assertThat(op.options().get("-dataproviderthreadcount")).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDependencyInjectorFactory() {
|
||||
var op = new TestNgOperation().dependencyInjectorFactory(FOO);
|
||||
assertThat(op.options.get("-dependencyinjectorfactory")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-dependencyinjectorfactory")).isEqualTo(FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDirectory() {
|
||||
var foo = new File("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
|
||||
void testExcludeGroups() {
|
||||
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));
|
||||
assertThat(op.options().get("-excludegroups")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExecute() {
|
||||
assertThatThrownBy(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.testClass("rife.bld.extension.TestNgSimpleTest")
|
||||
.testClass("rife.bld.extension.TestNgExampleTest")
|
||||
.execute())
|
||||
.as("with testClass").isInstanceOf(ExitStatusException.class);
|
||||
|
||||
|
@ -88,10 +183,9 @@ class TestNgOperationTest {
|
|||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.testClass("rife.bld.extension.TestNgSimpleTest")
|
||||
.methods("rife.bld.extension.TestNgSimpleTest.verifyHello")
|
||||
.methods("rife.bld.extension.TestNgExampleTest.foo")
|
||||
.execute())
|
||||
.as("with methods").doesNotThrowAnyException();
|
||||
.as("with methods").isInstanceOf(ExitStatusException.class);
|
||||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
|
@ -101,245 +195,329 @@ class TestNgOperationTest {
|
|||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.suites("src/test/resources/testng3.xml")
|
||||
.suites("src/test/resources/testng2.xml")
|
||||
.log(2)
|
||||
.execute())
|
||||
.as("suite 3").doesNotThrowAnyException();
|
||||
.as("suite 2 - log ").doesNotThrowAnyException();
|
||||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.suites("src/test/resources/testng3.xml")
|
||||
.suites("src/test/resources/testng2.xml")
|
||||
.testClasspath("lib/test/*", "build/main", "build/test")
|
||||
.log(2)
|
||||
.execute())
|
||||
.as("with run classpath").doesNotThrowAnyException();
|
||||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.suites("src/test/resources/testng2.xml")
|
||||
.testClasspath(List.of("lib/test/*", "build/main", "build/test"))
|
||||
.log(2)
|
||||
.execute())
|
||||
.as("with run classpath as list").doesNotThrowAnyException();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailWheneverEverythingSkipped() {
|
||||
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);
|
||||
assertThat(op.options.get("-failwheneverythingskipped")).isEqualTo("true");
|
||||
assertThat(op.options().get("-failwheneverythingskipped")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailurePolicy() {
|
||||
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);
|
||||
assertThat(op.options.get("-configfailurepolicy")).isEqualTo("skip");
|
||||
assertThat(op.options().get("-configfailurepolicy")).isEqualTo("skip");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGenerateResultsPerSuite() {
|
||||
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);
|
||||
assertThat(op.options.get("-generateResultsPerSuite")).isEqualTo("true");
|
||||
assertThat(op.options().get("-generateResultsPerSuite")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGroups() {
|
||||
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
|
||||
void testIgnoreMissedTestName() {
|
||||
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);
|
||||
assertThat(op.options.get("-ignoreMissedTestNames")).isEqualTo("true");
|
||||
assertThat(op.options().get("-ignoreMissedTestNames")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIncludeAllDataDrivenTestsWhenSkipping() {
|
||||
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);
|
||||
assertThat(op.options.get("-includeAllDataDrivenTestsWhenSkipping")).isEqualTo("true");
|
||||
assertThat(op.options().get("-includeAllDataDrivenTestsWhenSkipping")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testJar() {
|
||||
var op = new TestNgOperation().testJar(FOO);
|
||||
assertThat(op.options.get("-testjar")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-testjar")).isEqualTo(FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testJunit() {
|
||||
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);
|
||||
assertThat(op.options.get("-junit")).isEqualTo("true");
|
||||
assertThat(op.options().get("-junit")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testListener() {
|
||||
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));
|
||||
assertThat(ops.options().get("-listener")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMethodDetectors() {
|
||||
var op = new TestNgOperation().methodSelectors(FOO, BAR);
|
||||
assertThat(op.options.get("-methodselectors")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
assertThat(op.options().get("-methodselectors")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
op = new TestNgOperation().methodSelectors(List.of(FOO, BAR));
|
||||
assertThat(op.options().get("-methodselectors")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMethods() {
|
||||
var op = new TestNgOperation().methods(FOO, BAR);
|
||||
assertThat(op.options.get("-methods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
assertThat(op.methods()).containsExactly(BAR, FOO);
|
||||
|
||||
new TestNgOperation().methods(List.of(FOO, BAR));
|
||||
assertThat(op.methods()).containsExactly(BAR, FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMixed() {
|
||||
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);
|
||||
assertThat(op.options.get("-mixed")).isEqualTo("true");
|
||||
assertThat(op.options().get("-mixed")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testName() {
|
||||
var op = new TestNgOperation().testName(FOO);
|
||||
assertThat(op.options.get("-testname")).isEqualTo("\"" + FOO + '\"');
|
||||
assertThat(op.options().get("-testname")).isEqualTo("\"" + FOO + '\"');
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNames() {
|
||||
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));
|
||||
assertThat(ops.options().get("-testnames")).as("as list").isEqualTo(String.format("\"%s\",\"%s\"", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testObjectFactory() {
|
||||
var ops = new TestNgOperation().objectFactory(FOO, BAR);
|
||||
assertThat(ops.options.get("-objectfactory")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
assertThat(ops.options().get("-objectfactory")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
ops = new TestNgOperation().objectFactory(List.of(FOO, BAR));
|
||||
assertThat(ops.options().get("-objectfactory")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOverrideIncludedMethods() {
|
||||
var ops = new TestNgOperation().overrideIncludedMethods(FOO, BAR);
|
||||
assertThat(ops.options.get("-overrideincludedmethods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
assertThat(ops.options().get("-overrideincludedmethods")).isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
|
||||
ops = new TestNgOperation().overrideIncludedMethods(List.of(FOO, BAR));
|
||||
assertThat(ops.options().get("-overrideincludedmethods")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPackages() {
|
||||
var op = new TestNgOperation().packages(FOO, BAR);
|
||||
assertThat(op.packages).contains(FOO).contains(BAR);
|
||||
assertThat(op.packages()).contains(FOO).contains(BAR);
|
||||
|
||||
op = new TestNgOperation().packages(List.of(FOO, BAR));
|
||||
assertThat(op.packages()).as("as list").contains(FOO).contains(BAR);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testParallel() {
|
||||
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);
|
||||
assertThat(op.options.get("-parallel")).isEqualTo("methods");
|
||||
assertThat(op.options().get("-parallel")).isEqualTo("methods");
|
||||
|
||||
op = new TestNgOperation().parallel(TestNgOperation.Parallel.CLASSES);
|
||||
assertThat(op.options.get("-parallel")).isEqualTo("classes");
|
||||
assertThat(op.options().get("-parallel")).isEqualTo("classes");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPort() {
|
||||
var op = new TestNgOperation().port(1);
|
||||
assertThat(op.options.get("-port")).isEqualTo("1");
|
||||
assertThat(op.options().get("-port")).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPropagateDataProviderFailureAsTestFailure() {
|
||||
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);
|
||||
assertThat(op.options.get("-propagateDataProviderFailureAsTestFailure")).isEqualTo("true");
|
||||
assertThat(op.options().get("-propagateDataProviderFailureAsTestFailure")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testReported() {
|
||||
var op = new TestNgOperation().reporter(FOO);
|
||||
assertThat(op.options.get("-reporter")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-reporter")).isEqualTo(FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRunFactory() {
|
||||
var op = new TestNgOperation().testRunFactory(FOO);
|
||||
assertThat(op.options.get("-testrunfactory")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-testrunfactory")).isEqualTo(FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShareThreadPoolForDataProviders() {
|
||||
var op = new TestNgOperation().shareThreadPoolForDataProviders(true);
|
||||
assertThat(op.options().get("-shareThreadPoolForDataProviders")).isEqualTo("true");
|
||||
|
||||
op = new TestNgOperation().shareThreadPoolForDataProviders(false);
|
||||
assertThat(op.options().get("-shareThreadPoolForDataProviders")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
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);
|
||||
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));
|
||||
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
|
||||
void testSpiListenersToSkip() {
|
||||
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));
|
||||
assertThat(ops.options().get("-spilistenerstoskip")).as("as list").isEqualTo(String.format("%s,%s", FOO, BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuiteName() {
|
||||
var op = new TestNgOperation().suiteName(FOO);
|
||||
assertThat(op.options.get("-suitename")).isEqualTo("\"" + FOO + '\"');
|
||||
assertThat(op.options().get("-suitename")).isEqualTo("\"" + FOO + '\"');
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuiteThreadPoolSize() {
|
||||
var op = new TestNgOperation().suiteThreadPoolSize(1);
|
||||
assertThat(op.options.get("-suitethreadpoolsize")).isEqualTo("1");
|
||||
assertThat(op.options().get("-suitethreadpoolsize")).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuites() {
|
||||
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));
|
||||
assertThat(op.suites()).as("as list").contains(FOO).contains(BAR);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testThreadCount() {
|
||||
var op = new TestNgOperation().threadCount(1);
|
||||
assertThat(op.options.get("-threadcount")).isEqualTo("1");
|
||||
assertThat(op.options().get("-threadcount")).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testThreadPoolFactoryClass() {
|
||||
var op = new TestNgOperation().threadPoolFactoryClass(FOO);
|
||||
assertThat(op.options.get("-threadpoolfactoryclass")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-threadpoolfactoryclass")).isEqualTo(FOO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUseDefaultListeners() {
|
||||
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);
|
||||
assertThat(op.options.get("-usedefaultlisteners")).isEqualTo("true");
|
||||
assertThat(op.options().get("-usedefaultlisteners")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUseGlobalThreadPool() {
|
||||
var op = new TestNgOperation().useGlobalThreadPool(true);
|
||||
assertThat(op.options().get("-useGlobalThreadPool")).isEqualTo("true");
|
||||
|
||||
op = new TestNgOperation().useGlobalThreadPool(false);
|
||||
assertThat(op.options().get("-useGlobalThreadPool")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testVerbose() {
|
||||
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);
|
||||
assertThat(op.options.get("-verbose")).isEqualTo("1");
|
||||
assertThat(op.options().get("-verbose")).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testXmlPathInJar() {
|
||||
var foo = new File(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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Implements the TestNgSimpleTest class.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
class TestNgSimple2Test {
|
||||
public static void main(String[] args) {
|
||||
new TestNgSimple2Test().verifyHello();
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyHello() {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Implements the TestNgSimpleTest class.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
class TestNgSimpleTest {
|
||||
public static void main(String[] args) {
|
||||
new TestNgSimpleTest().verifyHello();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFail() {
|
||||
Assert.fail("failed");
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyHello() {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
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
|
|
@ -2,7 +2,11 @@
|
|||
<suite name="test suite 1" verbose="2">
|
||||
<test name="simple test">
|
||||
<classes>
|
||||
<class name="rife.bld.extension.TestNgSimpleTest"/>
|
||||
<class name="rife.bld.extension.TestNgExample"/>
|
||||
<methods>
|
||||
<exclude name="foo"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
|
@ -2,9 +2,9 @@
|
|||
<suite name="test suite 2" verbose="1">
|
||||
<test name="exclude fail">
|
||||
<classes>
|
||||
<class name="rife.bld.extension.TestNgSimpleTest">
|
||||
<class name="rife.bld.extension.TestNgExampleTest">
|
||||
<methods>
|
||||
<exclude name="testFail"/>
|
||||
<exclude name="foo"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
|
||||
<suite name="test suite 3">
|
||||
<test name="test 2 classes">
|
||||
<classes>
|
||||
<class name="rife.bld.extension.TestNgSimpleTest">
|
||||
<methods>
|
||||
<exclude name="testFail"/>
|
||||
</methods>
|
||||
</class>
|
||||
<class name="rife.bld.extension.TestNgSimple2Test"/>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
Loading…
Add table
Add a link
Reference in a new issue