Initial commit

This commit is contained in:
Erik C. Thauvin 2023-08-14 18:20:05 -07:00
commit da53dbf3d6
75 changed files with 2776 additions and 0 deletions

55
.gitignore vendored Normal file
View file

@ -0,0 +1,55 @@
.gradle
.DS_Store
build
lib/bld/**
!lib/bld/bld-wrapper.jar
!lib/bld/bld-wrapper.properties
lib/compile/
lib/runtime/
lib/standalone/
lib/test/
# IDEA ignores
# User-specific
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Editor-based Rest Client
.idea/httpRequests

3
.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

29
.idea/app.iml generated Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/main" />
<output-test url="file://$MODULE_DIR$/build/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="RUNTIME">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="compile" level="project" />
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
<orderEntry type="library" scope="TEST" name="test" level="project" />
</component>
</module>

14
.idea/bld.iml generated Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/bld" />
<output-test url="file://$MODULE_DIR$/build/bld" />
<exclude-output />
<content url="file://$MODULE_DIR$/src/bld">
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bld" level="project" />
</component>
</module>

View file

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
</profile>
</component>

17
.idea/libraries/bld.xml generated Normal file
View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.0-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
</excluded>
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>

13
.idea/libraries/compile.xml generated Normal file
View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="compile">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</CLASSES>
<JAVADOC />
<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" />
</library>
</component>

14
.idea/libraries/runtime.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="runtime">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
<root url="file://$PROJECT_DIR$/src/main/resources" />
</CLASSES>
<JAVADOC />
<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" />
</library>
</component>

14
.idea/libraries/test.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="test">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES>
<JAVADOC />
<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" />
</library>
</component>

18
.idea/misc.xml generated Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<pattern value="rife.bld.extension.TestNgOperationBuild" method="pmd" />
<pattern value="rife.bld.extension.TestNgOperationBuild" />
</component>
<component name="PDMPlugin">
<option name="customRuleSets">
<list>
<option value="K:\java\semver\config\pmd.xml" />
</list>
</option>
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>

9
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
</modules>
</component>
</project>

9
.idea/runConfigurations/Run Tests.xml generated Normal file
View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="rife.bld.extension.TestNgOperationTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

11
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "rife.bld.extension.TestNgOperationTest"
}
]
}

15
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.0.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

2
bld Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build rife.bld.extension.TestNgOperationBuild "$@"

4
bld.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build rife.bld.extension.TestNgOperationBuild %*

110
config/pmd.xml Normal file
View file

@ -0,0 +1,110 @@
<?xml version="1.0"?>
<ruleset name="erik"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Erik's Ruleset</description>
<!-- BEST PRACTICES -->
<rule ref="category/java/bestpractices.xml">
<exclude name="AvoidPrintStackTrace"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="GuardLogStatement"/>
</rule>
<rule ref="category/java/bestpractices.xml/MissingOverride">
<properties>
<property name="violationSuppressXPath"
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
</properties>
</rule>
<!-- CODE STYLE -->
<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="ClassNamingConventions"/>
<exclude name="ConfusingTernary"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="FieldNamingConventions"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PackageCase"/>
<exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="UselessParentheses"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
</rule>
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
<properties>
<property name="violationSuppressRegex" value="Unused (static|.*\.\*).*"/>
</properties>
</rule>
<!-- DESIGN -->
<rule ref="category/java/design.xml">
<exclude name="AvoidCatchingGenericException"/>
<exclude name="AvoidDeeplyNestedIfStmts"/>
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
<exclude name="CognitiveComplexity"/>
<exclude name="CyclomaticComplexity"/>
<exclude name="ExcessiveClassLength"/>
<exclude name="ExcessiveMethodLength"/>
<exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="GodClass"/>
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
<exclude name="NPathComplexity"/>
<exclude name="NcssCount"/>
<exclude name="TooManyFields"/>
<exclude name="TooManyMethods"/>
<exclude name="UseObjectForClearerAPI"/>
</rule>
<!-- DOCUMENTATION -->
<rule ref="category/java/documentation.xml">
<exclude name="CommentRequired"/>
<exclude name="CommentSize"/>
</rule>
<!-- ERROR PRONE -->
<rule ref="category/java/errorprone.xml">
<exclude name="AssignmentInOperand"/>
<exclude name="AvoidCatchingNPE"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="NullAssignment"/>
</rule>
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
<properties>
<property name="allowWhile" value="true"/>
<property name="allowFor" value="true"/>
<property name="allowIf" value="true"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
<properties>
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<!-- MULTITHREADING -->
<rule ref="category/java/multithreading.xml">
</rule>
<!-- PERFORMANCE -->
<rule ref="category/java/performance.xml">
</rule>
<!-- SECURITY -->
<rule ref="category/java/security.xml">
</rule>
</ruleset>

55
examples/.gitignore vendored Normal file
View file

@ -0,0 +1,55 @@
.gradle
.DS_Store
build
lib/bld/**
!lib/bld/bld-wrapper.jar
!lib/bld/bld-wrapper.properties
lib/compile/
lib/runtime/
lib/standalone/
lib/test/
# IDEA ignores
# User-specific
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Editor-based Rest Client
.idea/httpRequests

3
examples/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

29
examples/.idea/app.iml generated Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/main" />
<output-test url="file://$MODULE_DIR$/build/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="RUNTIME">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="compile" level="project" />
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
<orderEntry type="library" scope="TEST" name="test" level="project" />
</component>
</module>

14
examples/.idea/bld.iml generated Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/bld" />
<output-test url="file://$MODULE_DIR$/build/bld" />
<exclude-output />
<content url="file://$MODULE_DIR$/src/bld">
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bld" level="project" />
</component>
</module>

View file

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
</profile>
</component>

17
examples/.idea/libraries/bld.xml generated Normal file
View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.0-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
</excluded>
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>

13
examples/.idea/libraries/compile.xml generated Normal file
View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="compile">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</CLASSES>
<JAVADOC />
<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" />
</library>
</component>

14
examples/.idea/libraries/runtime.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="runtime">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
<root url="file://$PROJECT_DIR$/src/main/resources" />
</CLASSES>
<JAVADOC />
<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" />
</library>
</component>

14
examples/.idea/libraries/test.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="test">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES>
<JAVADOC />
<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" />
</library>
</component>

9
examples/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>

9
examples/.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.example.ExamplesTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

11
examples/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "com.example.ExamplesTest"
}
]
}

15
examples/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.0.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

2
examples/bld Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build com.example.ExamplesBuild "$@"

4
examples/bld.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build com.example.ExamplesBuild %*

Binary file not shown.

View file

@ -0,0 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extensions=com.uwyn.rife2:bld-testng:0.9.0-SNAPSHOT
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES,MAVEN_LOCAL
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.0

View file

@ -0,0 +1,35 @@
package com.example;
import rife.bld.BuildCommand;
import rife.bld.BaseProject;
import rife.bld.extension.TestNgOperation;
import java.util.List;
import java.io.IOException;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Scope.test;
public class ExamplesBuild extends BaseProject {
public ExamplesBuild() {
pkg = "com.example";
name = "Examples";
version = version(0,1,0);
repositories = List.of(MAVEN_CENTRAL);
scope(test).include(dependency("org.testng", "testng", version(7, 8, 0)));
}
public static void main(String[] args) {
new ExamplesBuild().start(args);
}
@BuildCommand(summary = "Run tests with TestNG")
public void testng() throws Exception {
new TestNgOperation()
.fromProject(this)
.packages("com.example")
.execute();
}
}

View file

@ -0,0 +1,7 @@
package com.example;
public class ExamplesLib {
public String getMessage() {
return "Hello World!";
}
}

View file

@ -0,0 +1,20 @@
package com.example;
import org.testng.Assert;
import org.testng.annotations.Test;
class ExampleTest {
@Test
void verifyHello() {
Assert.assertTrue(true);
}
@Test
void testFail() {
Assert.fail("failed");
}
public static void main(String[] args) {
new ExampleTest().verifyHello();
}
}

View file

@ -0,0 +1,156 @@
<html>
<head>
<title>TestNG: Command line test</title>
<link href="../testng.css" rel="stylesheet" type="text/css" />
<link href="../my-testng.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.log { display: none;}
.stack-trace { display: none;}
</style>
<script type="text/javascript">
<!--
function flip(e) {
current = e.style.display;
if (current == 'block') {
e.style.display = 'none';
return 0;
}
else {
e.style.display = 'block';
return 1;
}
}
function toggleBox(szDivId, elem, msg1, msg2)
{
var res = -1; if (document.getElementById) {
res = flip(document.getElementById(szDivId));
}
else if (document.all) {
// this is the way old msie versions work
res = flip(document.all[szDivId]);
}
if(elem) {
if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
}
}
function toggleAllBoxes() {
if (document.getElementsByTagName) {
d = document.getElementsByTagName('div');
for (i = 0; i < d.length; i++) {
if (d[i].className == 'log') {
flip(d[i]);
}
}
}
}
// -->
</script>
</head>
<body>
<h2 align='center'>Command line test</h2><table border='1' align="center">
<tr>
<td>Tests passed/Failed/Skipped:</td><td>1/1/0</td>
</tr><tr>
<td>Started on:</td><td>Mon Aug 14 16:35:09 PDT 2023</td>
</tr>
<tr><td>Total time:</td><td>0 seconds (26 ms)</td>
</tr><tr>
<td>Included groups:</td><td></td>
</tr><tr>
<td>Excluded groups:</td><td></td>
</tr>
</table><p/>
<small><i>(Hover the method name to see the test class name)</i></small><p/>
<table width='100%' border='1' class='invocation-failed'>
<tr><td colspan='4' align='center'><b>FAILED TESTS</b></td></tr>
<tr><td><b>Test method</b></td>
<td><b>Attribute(s)</b></td>
<td width="30%"><b>Exception</b></td>
<td width="10%"><b>Time (seconds)</b></td>
<td><b>Instance</b></td>
</tr>
<tr>
<td title='com.example.ExampleTest.testFail()'><b>testFail</b><br>Test class: com.example.ExampleTest</td>
<td><div><pre>java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
</pre></div><a href='#' onClick='toggleBox("stack-trace1157058691", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
<div class='stack-trace' id='stack-trace1157058691'><pre>java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
</pre></div></td>
<td>0</td>
<td>com.example.ExampleTest@72b6cbcc</td></tr>
</table><p>
<table width='100%' border='1' class='invocation-passed'>
<tr><td colspan='4' align='center'><b>PASSED TESTS</b></td></tr>
<tr><td><b>Test method</b></td>
<td><b>Attribute(s)</b></td>
<td width="30%"><b>Exception</b></td>
<td width="10%"><b>Time (seconds)</b></td>
<td><b>Instance</b></td>
</tr>
<tr>
<td title='com.example.ExampleTest.verifyHello()'><b>verifyHello</b><br>Test class: com.example.ExampleTest</td>
<td></td>
<td>0</td>
<td>com.example.ExampleTest@72b6cbcc</td></tr>
</table><p>
</body>
</html>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitXMLReporter -->
<testsuite ignored="0" hostname="gambit" failures="1" tests="2" name="Command line test" time="0.026" errors="0" timestamp="2023-08-14T16:35:09 PDT">
<testcase classname="com.example.ExampleTest" name="testFail" time="0.004">
<failure type="java.lang.AssertionError" message="failed">
<![CDATA[java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
]]>
</failure>
</testcase> <!-- testFail -->
<testcase classname="com.example.ExampleTest" name="verifyHello" time="0.001"/>
</testsuite> <!-- Command line test -->

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Failed suite [Command line suite]" verbose="2">
<test thread-count="5" name="Command line test(failed)" verbose="2">
<classes>
<class name="com.example.ExampleTest">
<methods>
<include name="testFail"/>
</methods>
</class> <!-- com.example.ExampleTest -->
</classes>
</test> <!-- Command line test(failed) -->
</suite> <!-- Failed suite [Command line suite] -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

View file

@ -0,0 +1,47 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "https://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>TestNG Report</title>
<style type="text/css">table {margin-bottom:10px;border-collapse:collapse;empty-cells:show}th,td {border:1px solid #009;padding:.25em .5em}th {vertical-align:bottom}td {vertical-align:top}table a {font-weight:bold}.stripe td {background-color: #E6EBF9}.num {text-align:right}.passedodd td {background-color: #3F3}.passedeven td {background-color: #0A0}.skippedodd td {background-color: #DDD}.skippedeven td {background-color: #CCC}.failedodd td,.attn {background-color: #F33}.failedeven td,.stripe .attn {background-color: #D00}.stacktrace {white-space:pre;font-family:monospace}.totop {font-size:85%;text-align:center;border-bottom:2px solid #000}.invisible {display:none}</style>
</head>
<body>
<table>
<tr><th>Test</th><th># Passed</th><th># Skipped</th><th># Retried</th><th># Failed</th><th>Time (ms)</th><th>Included Groups</th><th>Excluded Groups</th></tr>
<tr><th colspan="8">Command line suite</th></tr>
<tr><td><a href="#t0">Command line test</a></td><td class="num">1</td><td class="num">0</td><td class="num">0</td><td class="num attn">1</td><td class="num">26</td><td></td><td></td></tr>
</table>
<table id='summary'><thead><tr><th>Class</th><th>Method</th><th>Start</th><th>Time (ms)</th></tr></thead><tbody><tr><th colspan="4">Command line suite</th></tr></tbody><tbody id="t0"><tr><th colspan="4">Command line test &#8212; failed</th></tr><tr class="failedeven"><td rowspan="1">com.example.ExampleTest</td><td><a href="#m0">testFail</a></td><td rowspan="1">1692056109945</td><td rowspan="1">4</td></tr><tr><th colspan="4">Command line test &#8212; passed</th></tr><tr class="passedeven"><td rowspan="1">com.example.ExampleTest</td><td><a href="#m1">verifyHello</a></td><td rowspan="1">1692056109951</td><td rowspan="1">1</td></tr></tbody>
</table>
<h2>Command line test</h2><h3 id="m0">com.example.ExampleTest#testFail</h3><table class="result"><tr><th>Exception</th></tr><tr><td><div class="stacktrace">java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
</div></td></tr></table><p class="totop"><a href="#summary">back to summary</a></p>
<h3 id="m1">com.example.ExampleTest#verifyHello</h3><table class="result"><tr><th class="invisible"/></tr></table><p class="totop"><a href="#summary">back to summary</a></p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

View file

@ -0,0 +1,302 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>TestNG reports</title>
<link type="text/css" href="testng-reports1.css" rel="stylesheet" id="ultra" />
<link type="text/css" href="testng-reports.css" rel="stylesheet" id="retro" disabled="false"/>
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="testng-reports.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['table']});
google.setOnLoadCallback(drawTable);
var suiteTableInitFunctions = new Array();
var suiteTableData = new Array();
</script>
<!--
<script type="text/javascript" src="jquery-ui/js/jquery-ui-1.8.16.custom.min.js"></script>
-->
</head>
<body> <div class="top-banner-root">
<span class="top-banner-title-font">Test results</span>
<button id="button" class="button">Switch Retro Theme</button> <!-- button -->
<br/>
<span class="top-banner-font-1">1 suite, 1 failed test</span>
</div> <!-- top-banner-root -->
<div class="navigator-root">
<div class="navigator-suite-header">
<span>All suites</span>
<a href="#" title="Collapse/expand all the suites" class="collapse-all-link">
<img src="collapseall.gif" class="collapse-all-icon">
</img> <!-- collapse-all-icon -->
</a> <!-- collapse-all-link -->
</div> <!-- navigator-suite-header -->
<div class="suite">
<div class="rounded-window">
<div class="suite-header light-rounded-window-top">
<a href="#" panel-name="suite-Command_line_suite" class="navigator-link">
<span class="suite-name border-failed">Command line suite</span>
</a> <!-- navigator-link -->
</div> <!-- suite-header light-rounded-window-top -->
<div class="navigator-suite-content">
<div class="suite-section-title">
<span>Info</span>
</div> <!-- suite-section-title -->
<div class="suite-section-content">
<ul>
<li>
<a href="#" panel-name="test-xml-Command_line_suite" class="navigator-link ">
<span>[unset file name]</span>
</a> <!-- navigator-link -->
</li>
<li>
<a href="#" panel-name="testlist-Command_line_suite" class="navigator-link ">
<span class="test-stats">1 test</span>
</a> <!-- navigator-link -->
</li>
<li>
<a href="#" panel-name="group-Command_line_suite" class="navigator-link ">
<span>0 groups</span>
</a> <!-- navigator-link -->
</li>
<li>
<a href="#" panel-name="times-Command_line_suite" class="navigator-link ">
<span>Times</span>
</a> <!-- navigator-link -->
</li>
<li>
<a href="#" panel-name="reporter-Command_line_suite" class="navigator-link ">
<span>Reporter output</span>
</a> <!-- navigator-link -->
</li>
<li>
<a href="#" panel-name="ignored-methods-Command_line_suite" class="navigator-link ">
<span>Ignored methods</span>
</a> <!-- navigator-link -->
</li>
<li>
<a href="#" panel-name="chronological-Command_line_suite" class="navigator-link ">
<span>Chronological view</span>
</a> <!-- navigator-link -->
</li>
</ul>
</div> <!-- suite-section-content -->
<div class="result-section">
<div class="suite-section-title">
<span>Results</span>
</div> <!-- suite-section-title -->
<div class="suite-section-content">
<ul>
<li>
<span class="method-stats">2 methods, 1 failed, 1 passed</span>
</li>
<li>
<span class="method-list-title failed">Failed methods</span>
<span class="show-or-hide-methods failed">
<a href="#" panel-name="suite-Command_line_suite" class="hide-methods failed suite-Command_line_suite"> (hide)</a> <!-- hide-methods failed suite-Command_line_suite -->
<a href="#" panel-name="suite-Command_line_suite" class="show-methods failed suite-Command_line_suite"> (show)</a> <!-- show-methods failed suite-Command_line_suite -->
</span>
<div class="method-list-content failed suite-Command_line_suite">
<span>
<img src="failed.png" width="3%"/>
<a href="#" panel-name="suite-Command_line_suite" title="com.example.ExampleTest" class="method navigator-link" hash-for-method="testFail">testFail</a> <!-- method navigator-link -->
</span>
<br/>
</div> <!-- method-list-content failed suite-Command_line_suite -->
</li>
<li>
<span class="method-list-title passed">Passed methods</span>
<span class="show-or-hide-methods passed">
<a href="#" panel-name="suite-Command_line_suite" class="hide-methods passed suite-Command_line_suite"> (hide)</a> <!-- hide-methods passed suite-Command_line_suite -->
<a href="#" panel-name="suite-Command_line_suite" class="show-methods passed suite-Command_line_suite"> (show)</a> <!-- show-methods passed suite-Command_line_suite -->
</span>
<div class="method-list-content passed suite-Command_line_suite">
<span>
<img src="passed.png" width="3%"/>
<a href="#" panel-name="suite-Command_line_suite" title="com.example.ExampleTest" class="method navigator-link" hash-for-method="verifyHello">verifyHello</a> <!-- method navigator-link -->
</span>
<br/>
</div> <!-- method-list-content passed suite-Command_line_suite -->
</li>
</ul>
</div> <!-- suite-section-content -->
</div> <!-- result-section -->
</div> <!-- navigator-suite-content -->
</div> <!-- rounded-window -->
</div> <!-- suite -->
</div> <!-- navigator-root -->
<div class="wrapper">
<div class="main-panel-root">
<div panel-name="suite-Command_line_suite" class="panel Command_line_suite">
<div class="suite-Command_line_suite-class-failed">
<div class="main-panel-header rounded-window-top">
<img src="failed.png"/>
<span class="class-name">com.example.ExampleTest</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
<div class="method">
<div class="method-content">
<a name="testFail">
</a> <!-- testFail -->
<span class="method-name">testFail</span>
<div class="stack-trace">java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
</div> <!-- stack-trace -->
</div> <!-- method-content -->
</div> <!-- method -->
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- suite-Command_line_suite-class-failed -->
<div class="suite-Command_line_suite-class-passed">
<div class="main-panel-header rounded-window-top">
<img src="passed.png"/>
<span class="class-name">com.example.ExampleTest</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
<div class="method">
<div class="method-content">
<a name="verifyHello">
</a> <!-- verifyHello -->
<span class="method-name">verifyHello</span>
</div> <!-- method-content -->
</div> <!-- method -->
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- suite-Command_line_suite-class-passed -->
</div> <!-- panel Command_line_suite -->
<div panel-name="test-xml-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE suite SYSTEM &quot;https://testng.org/testng-1.0.dtd&quot;&gt;
&lt;suite name=&quot;Command line suite&quot; verbose=&quot;2&quot;&gt;
&lt;test thread-count=&quot;5&quot; name=&quot;Command line test&quot; verbose=&quot;2&quot;&gt;
&lt;classes&gt;
&lt;class name=&quot;com.example.ExampleTest&quot;/&gt;
&lt;/classes&gt;
&lt;/test&gt; &lt;!-- Command line test --&gt;
&lt;/suite&gt; &lt;!-- Command line suite --&gt;
</pre>
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
<div panel-name="testlist-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
<span class="header-content">Tests for Command line suite</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
<ul>
<li>
<span class="test-name">Command line test (1 class)</span>
</li>
</ul>
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
<div panel-name="group-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
<span class="header-content">Groups for Command line suite</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
<div panel-name="times-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
<span class="header-content">Times for Command line suite</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
<div class="times-div">
<script type="text/javascript">
suiteTableInitFunctions.push('tableData_Command_line_suite');
function tableData_Command_line_suite() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Number');
data.addColumn('string', 'Method');
data.addColumn('string', 'Class');
data.addColumn('number', 'Time (ms)');
data.addRows(2);
data.setCell(0, 0, 0)
data.setCell(0, 1, 'testFail')
data.setCell(0, 2, 'com.example.ExampleTest')
data.setCell(0, 3, 4);
data.setCell(1, 0, 1)
data.setCell(1, 1, 'verifyHello')
data.setCell(1, 2, 'com.example.ExampleTest')
data.setCell(1, 3, 1);
window.suiteTableData['Command_line_suite']= { tableData: data, tableDiv: 'times-div-Command_line_suite'}
return data;
}
</script>
<span class="suite-total-time">Total running time: 5 ms</span>
<div id="times-div-Command_line_suite">
</div> <!-- times-div-Command_line_suite -->
</div> <!-- times-div -->
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
<div panel-name="reporter-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
<span class="header-content">Reporter output for Command line suite</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
<div panel-name="ignored-methods-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
<span class="header-content">0 ignored methods</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
<div panel-name="chronological-Command_line_suite" class="panel">
<div class="main-panel-header rounded-window-top">
<span class="header-content">Methods in chronological order</span>
</div> <!-- main-panel-header rounded-window-top -->
<div class="main-panel-content rounded-window-bottom">
<div class="chronological-class">
<div class="chronological-class-name">com.example.ExampleTest</div> <!-- chronological-class-name -->
<div class="test-method">
<img src="failed.png">
</img>
<span class="method-name">testFail</span>
<span class="method-start">0 ms</span>
</div> <!-- test-method -->
<div class="test-method">
<span class="method-name">verifyHello</span>
<span class="method-start">6 ms</span>
</div> <!-- test-method -->
</div> <!-- main-panel-content rounded-window-bottom -->
</div> <!-- panel -->
</div> <!-- main-panel-root -->
</div> <!-- wrapper -->
</body>
<script type="text/javascript" src="testng-reports2.js"></script>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="gambit" failures="1" tests="2" name="com.example.ExampleTest" time="0.005" errors="0" timestamp="2023-08-14T16:35:10 PDT" skipped="0">
<testcase classname="com.example.ExampleTest" name="testFail" time="0.004">
<failure message="failed" type="java.lang.AssertionError">
<![CDATA[java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
]]>
</failure>
</testcase> <!-- testFail -->
<testcase classname="com.example.ExampleTest" name="verifyHello" time="0.001"/>
</testsuite> <!-- com.example.ExampleTest -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

View file

@ -0,0 +1 @@
[SuiteResult context=Command line test]

View file

@ -0,0 +1,32 @@
<table border='1'>
<tr>
<th>Class name</th>
<th>Method name</th>
<th>Groups</th>
</tr><tr>
<td>com.example.ExampleTest</td>
<td>&nbsp;</td><td>&nbsp;</td></tr>
<tr>
<td align='center' colspan='3'>@Test</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>verifyHello</td>
<td>&nbsp;</td></tr>
<tr>
<td>&nbsp;</td>
<td>testFail</td>
<td>&nbsp;</td></tr>
<tr>
<td align='center' colspan='3'>@BeforeClass</td>
</tr>
<tr>
<td align='center' colspan='3'>@BeforeMethod</td>
</tr>
<tr>
<td align='center' colspan='3'>@AfterMethod</td>
</tr>
<tr>
<td align='center' colspan='3'>@AfterClass</td>
</tr>
</table>

View file

@ -0,0 +1 @@
<h2>Groups used for this test run</h2>

View file

@ -0,0 +1,6 @@
<html><head><title>Results for Command line suite</title></head>
<frameset cols="26%,74%">
<frame src="toc.html" name="navFrame">
<frame src="main.html" name="mainFrame">
</frameset>
</html>

View file

@ -0,0 +1,2 @@
<html><head><title>Results for Command line suite</title></head>
<body>Select a result on the left-hand pane.</body></html>

View file

@ -0,0 +1,8 @@
<h2>Methods run, sorted chronologically</h2><h3>&gt;&gt; means before, &lt;&lt; means after</h3><p/><br/><em>Command line suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="bd9462"> <td>23/08/14 16:35:09</td> <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ExampleTest.testFail()[pri:0, instance:com.example.ExampleTest@72b6cbcc]">testFail</td>
<td>main@498931366</td> <td></td> </tr>
<tr bgcolor="bd9462"> <td>23/08/14 16:35:09</td> <td>7</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ExampleTest.verifyHello()[pri:0, instance:com.example.ExampleTest@72b6cbcc]">verifyHello</td>
<td>main@498931366</td> <td></td> </tr>
</table>

View file

@ -0,0 +1,2 @@
<h2>Methods that were not run</h2><table>
</table>

View file

@ -0,0 +1,8 @@
<h2>Methods run, sorted chronologically</h2><h3>&gt;&gt; means before, &lt;&lt; means after</h3><p/><br/><em>Command line suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="bd9462"> <td>23/08/14 16:35:09</td> <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ExampleTest.testFail()[pri:0, instance:com.example.ExampleTest@72b6cbcc]">testFail</td>
<td>main@498931366</td> <td></td> </tr>
<tr bgcolor="bd9462"> <td>23/08/14 16:35:09</td> <td>7</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ExampleTest.verifyHello()[pri:0, instance:com.example.ExampleTest@72b6cbcc]">verifyHello</td>
<td>main@498931366</td> <td></td> </tr>
</table>

View file

@ -0,0 +1 @@
<h2>Reporter output</h2><table></table>

View file

@ -0,0 +1 @@
<html><head><title>testng.xml for Command line suite</title></head><body><tt>&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;<br/>&lt;!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"https://testng.org/testng-1.0.dtd"&gt;<br/>&lt;suite&nbsp;name="Command&nbsp;line&nbsp;suite"&nbsp;verbose="2"&gt;<br/>&nbsp;&nbsp;&lt;test&nbsp;thread-count="5"&nbsp;name="Command&nbsp;line&nbsp;test"&nbsp;verbose="2"&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="com.example.ExampleTest"/&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;<br/>&nbsp;&nbsp;&lt;/test&gt;&nbsp;&lt;!--&nbsp;Command&nbsp;line&nbsp;test&nbsp;--&gt;<br/>&lt;/suite&gt;&nbsp;&lt;!--&nbsp;Command&nbsp;line&nbsp;suite&nbsp;--&gt;<br/></tt></body></html>

View file

@ -0,0 +1,30 @@
<html>
<head>
<title>Results for Command line suite</title>
<link href="../testng.css" rel="stylesheet" type="text/css" />
<link href="../my-testng.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3><p align="center">Results for<br/><em>Command line suite</em></p></h3>
<table border='1' width='100%'>
<tr valign='top'>
<td>1 test</td>
<td><a target='mainFrame' href='classes.html'>1 class</a></td>
<td>2 methods:<br/>
&nbsp;&nbsp;<a target='mainFrame' href='methods.html'>chronological</a><br/>
&nbsp;&nbsp;<a target='mainFrame' href='methods-alphabetical.html'>alphabetical</a><br/>
&nbsp;&nbsp;<a target='mainFrame' href='methods-not-run.html'>not run (0)</a></td>
</tr>
<tr>
<td><a target='mainFrame' href='groups.html'>0 group</a></td>
<td><a target='mainFrame' href='reporter-output.html'>reporter output</a></td>
<td><a target='mainFrame' href='testng.xml.html'>testng.xml</a></td>
</tr></table>
<table width='100%' class='test-failed'>
<tr><td>
<table style='width: 100%'><tr><td valign='top'>Command line test (1/1/0)</td><td valign='top' align='right'>
<a href='Command line test.html' target='mainFrame'>Results</a>
</td></tr></table>
</td></tr><p/>
</table>
</body></html>

View file

@ -0,0 +1,9 @@
<html>
<head><title></title><link href="./testng.css" rel="stylesheet" type="text/css" />
<link href="./my-testng.css" rel="stylesheet" type="text/css" />
</head><body>
<h2><p align='center'>Test results</p></h2>
<table border='1' width='100%' class='main-page'><tr><th>Suite</th><th>Passed</th><th>Failed</th><th>Skipped</th><th>testng.xml</th></tr>
<tr align='center' class='invocation-failed'><td><em>Total</em></td><td><em>1</em></td><td><em>1</em></td><td><em>0</em></td><td>&nbsp;</td></tr>
<tr align='center' class='invocation-failed'><td><a href='Command line suite/index.html'>Command line suite</a></td>
<td>1</td><td>1</td><td>0</td><td><a href='Command line suite/testng.xml.html'>Link</a></td></tr></table></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Failed suite [Command line suite]" verbose="2">
<test thread-count="5" name="Command line test(failed)" verbose="2">
<classes>
<class name="com.example.ExampleTest">
<methods>
<include name="testFail"/>
</methods>
</class> <!-- com.example.ExampleTest -->
</classes>
</test> <!-- Command line test(failed) -->
</suite> <!-- Failed suite [Command line suite] -->

View file

@ -0,0 +1,326 @@
body {
margin: 0 0 5px 5px;
}
ul {
margin: 0;
}
li {
list-style-type: none;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.navigator-selected {
background: #ffa500;
}
.wrapper {
position: absolute;
top: 60px;
bottom: 0;
left: 400px;
right: 0;
overflow: auto;
}
.navigator-root {
position: absolute;
top: 60px;
bottom: 0;
left: 0;
width: 400px;
overflow-y: auto;
}
.suite {
margin: 0 10px 10px 0;
background-color: #fff8dc;
}
.suite-name {
padding-left: 10px;
font-size: 25px;
font-family: Times, sans-serif;
}
.main-panel-header {
padding: 5px;
background-color: #9FB4D9; /*afeeee*/;
font-family: monospace;
font-size: 18px;
}
.main-panel-content {
padding: 5px;
margin-bottom: 10px;
background-color: #DEE8FC; /*d0ffff*/;
}
.rounded-window {
border-radius: 10px;
border-style: solid;
border-width: 1px;
}
.rounded-window-top {
border-top-right-radius: 10px 10px;
border-top-left-radius: 10px 10px;
border-style: solid;
border-width: 1px;
overflow: auto;
}
.light-rounded-window-top {
border-top-right-radius: 10px 10px;
border-top-left-radius: 10px 10px;
}
.rounded-window-bottom {
border-style: solid;
border-width: 0 1px 1px 1px;
border-bottom-right-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
overflow: auto;
}
.method-name {
font-size: 12px;
font-family: monospace;
}
.method-content {
border-style: solid;
border-width: 0 0 1px 0;
margin-bottom: 10px;
padding-bottom: 5px;
width: 80%;
}
.parameters {
font-size: 14px;
font-family: monospace;
}
.stack-trace {
white-space: pre;
font-family: monospace;
font-size: 12px;
font-weight: bold;
margin-top: 0;
margin-left: 20px;
}
.testng-xml {
font-family: monospace;
}
.method-list-content {
margin-left: 10px;
}
.navigator-suite-content {
margin-left: 10px;
font: 12px 'Lucida Grande';
}
.suite-section-title {
margin-top: 10px;
width: 80%;
border-style: solid;
border-width: 1px 0 0 0;
font-family: Times, sans-serif;
font-size: 18px;
font-weight: bold;
}
.suite-section-content {
list-style-image: url(bullet_point.png);
}
.top-banner-root {
position: absolute;
top: 0;
height: 45px;
left: 0;
right: 0;
padding: 5px;
margin: 0 0 5px 0;
background-color: #0066ff;
font-family: Times, sans-serif;
color: #fff;
text-align: center;
}
.button{
position: absolute;
margin-left:500px;
margin-top:8px;
background-color: white;
color:#0066ff;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight:bold;
border-color:#0066ff ;
border-radius:25px;
cursor: pointer;
height:30px;
width:150px;
outline:none;
}
.top-banner-title-font {
font-size: 25px;
}
.test-name {
font-family: 'Lucida Grande', sans-serif;
font-size: 16px;
}
.suite-icon {
padding: 5px;
float: right;
height: 20px;
}
.test-group {
font: 20px 'Lucida Grande';
margin: 5px 5px 10px 5px;
border-width: 0 0 1px 0;
border-style: solid;
padding: 5px;
}
.test-group-name {
font-weight: bold;
}
.method-in-group {
font-size: 16px;
margin-left: 80px;
}
table.google-visualization-table-table {
width: 100%;
}
.reporter-method-name {
font-size: 14px;
font-family: monospace;
}
.reporter-method-output-div {
padding: 5px;
margin: 0 0 5px 20px;
font-size: 12px;
font-family: monospace;
border-width: 0 0 0 1px;
border-style: solid;
}
.ignored-class-div {
font-size: 14px;
font-family: monospace;
}
.ignored-methods-div {
padding: 5px;
margin: 0 0 5px 20px;
font-size: 12px;
font-family: monospace;
border-width: 0 0 0 1px;
border-style: solid;
}
.border-failed {
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-style: solid;
border-width: 0 0 0 10px;
border-color: #f00;
}
.border-skipped {
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-style: solid;
border-width: 0 0 0 10px;
border-color: #edc600;
}
.border-passed {
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-style: solid;
border-width: 0 0 0 10px;
border-color: #19f52d;
}
.times-div {
text-align: center;
padding: 5px;
}
.suite-total-time {
font: 16px 'Lucida Grande';
}
.configuration-suite {
margin-left: 20px;
}
.configuration-test {
margin-left: 40px;
}
.configuration-class {
margin-left: 60px;
}
.configuration-method {
margin-left: 80px;
}
.test-method {
margin-left: 100px;
}
.chronological-class {
background-color: skyblue;
border-style: solid;
border-width: 0 0 1px 1px;
}
.method-start {
float: right;
}
.chronological-class-name {
padding: 0 0 0 5px;
color: #008;
}
.after, .before, .test-method {
font-family: monospace;
font-size: 14px;
}
.navigator-suite-header {
font-size: 22px;
margin: 0 10px 5px 0;
background-color: #deb887;
text-align: center;
}
.collapse-all-icon {
padding: 5px;
float: right;
}
/*retro Theme*/

View file

@ -0,0 +1,122 @@
$(document).ready(function() {
$('a.navigator-link').on("click", function() {
// Extract the panel for this link
var panel = getPanelName($(this));
// Mark this link as currently selected
$('.navigator-link').parent().removeClass('navigator-selected');
$(this).parent().addClass('navigator-selected');
showPanel(panel);
});
installMethodHandlers('failed');
installMethodHandlers('skipped');
installMethodHandlers('passed', true); // hide passed methods by default
$('a.method').on("click", function() {
showMethod($(this));
return false;
});
// Hide all the panels and display the first one (do this last
// to make sure the click() will invoke the listeners)
$('.panel').hide();
$('.navigator-link').first().trigger("click");
// Collapse/expand the suites
$('a.collapse-all-link').on("click", function() {
var contents = $('.navigator-suite-content');
if (contents.css('display') == 'none') {
contents.show();
} else {
contents.hide();
}
});
});
// The handlers that take care of showing/hiding the methods
function installMethodHandlers(name, hide) {
function getContent(t) {
return $('.method-list-content.' + name + "." + t.attr('panel-name'));
}
function getHideLink(t, name) {
var s = 'a.hide-methods.' + name + "." + t.attr('panel-name');
return $(s);
}
function getShowLink(t, name) {
return $('a.show-methods.' + name + "." + t.attr('panel-name'));
}
function getMethodPanelClassSel(element, name) {
var panelName = getPanelName(element);
var sel = '.' + panelName + "-class-" + name;
return $(sel);
}
$('a.hide-methods.' + name).on("click", function() {
var w = getContent($(this));
w.hide();
getHideLink($(this), name).hide();
getShowLink($(this), name).show();
getMethodPanelClassSel($(this), name).hide();
});
$('a.show-methods.' + name).on("click", function() {
var w = getContent($(this));
w.show();
getHideLink($(this), name).show();
getShowLink($(this), name).hide();
showPanel(getPanelName($(this)));
getMethodPanelClassSel($(this), name).show();
});
if (hide) {
$('a.hide-methods.' + name).trigger("click");
} else {
$('a.show-methods.' + name).trigger("click");
}
}
function getHashForMethod(element) {
return element.attr('hash-for-method');
}
function getPanelName(element) {
return element.attr('panel-name');
}
function showPanel(panelName) {
$('.panel').hide();
var panel = $('.panel[panel-name="' + panelName + '"]');
panel.show();
}
function showMethod(element) {
var hashTag = getHashForMethod(element);
var panelName = getPanelName(element);
showPanel(panelName);
var current = document.location.href;
var base = current.substring(0, current.indexOf('#'))
document.location.href = base + '#' + hashTag;
var newPosition = $(document).scrollTop() - 65;
$(document).scrollTop(newPosition);
}
function drawTable() {
for (var i = 0; i < suiteTableInitFunctions.length; i++) {
window[suiteTableInitFunctions[i]]();
}
for (var k in window.suiteTableData) {
var v = window.suiteTableData[k];
var div = v.tableDiv;
var data = v.tableData
var table = new google.visualization.Table(document.getElementById(div));
table.draw(data, {
showRowNumber : false
});
}
}

View file

@ -0,0 +1,344 @@
body {
background-color: whitesmoke;
margin: 0 0 5px 5px;
}
ul {
margin-top: 10px;
margin-left:-10px;
}
li {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding:5px 5px;
}
a {
text-decoration: none;
color: black;
font-size: 14px;
}
a:hover {
color:black ;
text-decoration: underline;
}
.navigator-selected {
/* #ffa500; Mouse hover color after click Orange.*/
background:#027368
}
.wrapper {
position: absolute;
top: 60px;
bottom: 0;
left: 400px;
right: 0;
margin-right:9px;
overflow: auto;/*imortant*/
}
.navigator-root {
position: absolute;
top: 60px;
bottom: 0;
left: 0;
width: 400px;
overflow-y: auto;/*important*/
}
.suite {
margin: -5px 10px 10px 5px;
background-color: whitesmoke ;/*Colour of the left bside box*/
}
.suite-name {
font-size: 24px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;/*All TEST SUITE*/
color: white;
}
.main-panel-header {
padding: 5px;
background-color: #027368; /*afeeee*/;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color:white;
font-size: 18px;
}
.main-panel-content {
padding: 5px;
margin-bottom: 10px;
background-color: #CCD0D1; /*d0ffff*/; /*Belongs to backGround of rightSide boxes*/
}
.rounded-window {
border-style: dotted;
border-width: 1px;/*Border of left Side box*/
background-color: whitesmoke;
border-radius: 10px;
}
.rounded-window-top {
border-top-right-radius: 10px 10px;
border-top-left-radius: 10px 10px;
border-style: solid;
border-width: 1px;
overflow: auto;/*Top of RightSide box*/
}
.light-rounded-window-top {
background-color: #027368;
padding-left:120px;
border-radius: 10px;
}
.rounded-window-bottom {
border-bottom-right-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
overflow: auto;/*Bottom of rightSide box*/
}
.method-name {
font-size: 14px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: bold;
}
.method-content {
border-style: solid;
border-width: 0 0 1px 0;
margin-bottom: 10px;
padding-bottom: 5px;
width: 100%;
}
.parameters {
font-size: 14px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.stack-trace {
white-space: pre;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
font-weight: bold;
margin-top: 0;
margin-left: 20px; /*Error Stack Trace Message*/
}
.testng-xml {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.method-list-content {
margin-left: 10px;
}
.navigator-suite-content {
margin-left: 10px;
font: 12px 'Lucida Grande';
}
.suite-section-title {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight:bold;
background-color: #8C8887;
margin-left: -10px;
margin-top:10px;
padding:6px;
}
.suite-section-content {
list-style-image: url(bullet_point.png);
background-color: whitesmoke;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
overflow: hidden;
}
.top-banner-root {
position: absolute;
top: 0;
height: 45px;
left: 0;
right: 0;
padding: 5px;
margin: 0 0 5px 0;
background-color: #027368;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 18px;
color: #fff;
text-align: center;/*Belongs to the Top of Report*//*Status: - Completed*/
}
.top-banner-title-font {
font-size: 25px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 3px;
float: right;
}
.test-name {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
}
.suite-icon {
padding: 5px;
float: right;
height: 20px;
}
.test-group {
font: 20px 'Lucida Grande';
margin: 5px 5px 10px 5px;
border-width: 0 0 1px 0;
border-style: solid;
padding: 5px;
}
.test-group-name {
font-weight: bold;
}
.method-in-group {
font-size: 16px;
margin-left: 80px;
}
table.google-visualization-table-table {
width: 100%;
}
.reporter-method-name {
font-size: 14px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.reporter-method-output-div {
padding: 5px;
margin: 0 0 5px 20px;
font-size: 12px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
border-width: 0 0 0 1px;
border-style: solid;
}
.ignored-class-div {
font-size: 14px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.ignored-methods-div {
padding: 5px;
margin: 0 0 5px 20px;
font-size: 12px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
border-width: 0 0 0 1px;
border-style: solid;
}
.border-failed {
border-radius:2px;
border-style: solid;
border-width: 0 0 0 10px;
border-color: #F20505;
}
.border-skipped {
border-radius:2px;
border-style: solid;
border-width: 0 0 0 10px;
border-color: #F2BE22;
}
.border-passed {
border-radius:2px;
border-style: solid;
border-width: 0 0 0 10px;
border-color: #038C73;
}
.times-div {
text-align: center;
padding: 5px;
}
.suite-total-time {
font: 16px 'Lucida Grande';
}
.configuration-suite {
margin-left: 20px;
}
.configuration-test {
margin-left: 40px;
}
.configuration-class {
margin-left: 60px;
}
.configuration-method {
margin-left: 80px;
}
.test-method {
margin-left: 100px;
}
.chronological-class {
background-color: #CCD0D1;
border-width: 0 0 1px 1px;/*Chronological*/
}
.method-start {
float: right;
}
.chronological-class-name {
padding: 0 0 0 5px;
margin-top:5px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #008;
}
.after, .before, .test-method {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
margin-top:5px;
}
.navigator-suite-header {
font-size: 18px;
margin: 0px 10px 10px 5px;
padding: 5px;
border-radius: 10px;
background-color: #027368;
color: white;
font-weight:bold;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center; /*All Suites on top of left box*//*Status: -Completed*/
}
.collapse-all-icon {
padding: 3px;
float: right;
}
.button{
position: absolute;
margin-left:500px;
margin-top:8px;
background-color: white;
color:#027368;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight:bold;
border-color:#027368;
border-radius:25px;
cursor: pointer;
height:30px;
width:150px;
outline: none;
}
/*Author: - Akhil Gullapalli*/

View file

@ -0,0 +1,76 @@
window.onload = function () {
let cookies = document.cookie;
let cookieValue = cookies.split('=');
if (cookieValue[1] === 'null' || localStorage.getItem('Theme') === 'null') {
document.getElementById('retro').setAttribute('disabled', 'false');
} else if (cookieValue[1] === 'Switch Ultra Theme' ||
localStorage.getItem('Theme') === 'Switch Ultra Theme') {
document.getElementById('button').innerText = "Switch Retro Theme";
document.getElementById('retro').setAttribute('disabled', 'false');
} else if (cookieValue[1] === 'Switch Retro Theme' ||
localStorage.getItem('Theme') === 'Switch Retro Theme') {
if (cookieValue[1] === 'Switch Ultra Theme' ||
localStorage.getItem('Theme') === 'Switch Ultra Theme') {
document.getElementById('button').innerText = "Switch Retro Theme";
document.getElementById('retro').setAttribute('disabled', 'false');
document.getElementById('button').innerText = "Switch Ultra Theme";
document.getElementById('retro').removeAttribute('disabled');
document.getElementById('ultra').setAttribute('disabled', 'false');
localStorage.setItem('Theme', select);
} else if (select === 'Switch Ultra Theme') {
document.getElementById('button').innerText = "Switch Retro Theme";
document.getElementById('ultra').removeAttribute('disabled');
document.getElementById('retro').setAttribute('disabled', 'false');
localStorage.setItem('Theme', select);
}
} else if (cookieValue[1] === 'Switch Retro Theme' ||
localStorage.getItem('Theme') === 'Switch Retro Theme') {
document.getElementById('button').innerText = "Switch Ultra Theme";
document.getElementById('ultra').setAttribute('disabled', 'false');
}
}
document.getElementById('button').onclick = function () {
let select = document.getElementById('button').innerText;
if (select === 'Switch Retro Theme') {
let d = new Date();
days = 365;
d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000
document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";";
document.getElementById('button').innerText = "Switch Ultra Theme";
document.getElementById('retro').removeAttribute('disabled');
document.getElementById('ultra').setAttribute('disabled', 'false');
localStorage.setItem('Theme', select);
} else if (select === 'Switch Ultra Theme') {
let d = new Date();
days = 365;
d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000
document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";";
document.getElementById('button').innerText = "Switch Retro Theme";
document.getElementById('ultra').removeAttribute('disabled');
document.getElementById('retro').setAttribute('disabled', 'false');
localStorage.setItem('Theme', select);
}
}
//Function to mouse hovering affect.
document.getElementById('button').onmouseover = function () {
document.getElementById('button').style.borderRadius = "25px";
document.getElementById('button').style.width = "180px";
document.getElementById('button').style.height = "45px";
document.getElementById('button').style.marginTop = "1px";
}
//Function to mouse out affect
document.getElementById('button').onmouseout = function () {
document.getElementById('button').style.borderRadius = "25px";
document.getElementById('button').style.width = "150px";
document.getElementById('button').style.height = "30px";
document.getElementById('button').style.marginTop = "8px";
}
//This is the file where we handle the switching of the Themes.
/*Author:- Akhil Gullapalli*/

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="0" total="2" passed="1" failed="1" skipped="0">
<reporter-output>
</reporter-output>
<suite started-at="2023-08-14T16:35:09 PDT" name="Command line suite" finished-at="2023-08-14T16:35:09 PDT" duration-ms="26">
<groups>
</groups>
<test started-at="2023-08-14T16:35:09 PDT" name="Command line test" finished-at="2023-08-14T16:35:09 PDT" duration-ms="26">
<class name="com.example.ExampleTest">
<test-method signature="testFail()[pri:0, instance:com.example.ExampleTest@72b6cbcc]" started-at="2023-08-14T16:35:09 PDT" name="testFail" finished-at="2023-08-14T16:35:09 PDT" duration-ms="4" status="FAIL">
<exception class="java.lang.AssertionError">
<message>
<![CDATA[failed]]>
</message>
<full-stacktrace>
<![CDATA[java.lang.AssertionError: failed
at org.testng.Assert.fail(Assert.java:111)
at com.example.ExampleTest.testFail(ExamplesTest.java:14)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.TestNG.privateMain(TestNG.java:1440)
at org.testng.TestNG.main(TestNG.java:1404)
]]>
</full-stacktrace>
</exception> <!-- java.lang.AssertionError -->
<reporter-output>
</reporter-output>
</test-method> <!-- testFail -->
<test-method signature="verifyHello()[pri:0, instance:com.example.ExampleTest@72b6cbcc]" started-at="2023-08-14T16:35:09 PDT" name="verifyHello" finished-at="2023-08-14T16:35:09 PDT" duration-ms="1" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- verifyHello -->
</class> <!-- com.example.ExampleTest -->
</test> <!-- Command line test -->
</suite> <!-- Command line suite -->
</testng-results>

View file

@ -0,0 +1,9 @@
.invocation-failed, .test-failed { background-color: #DD0000; }
.invocation-percent, .test-percent { background-color: #006600; }
.invocation-passed, .test-passed { background-color: #00AA00; }
.invocation-skipped, .test-skipped { background-color: #CCCC00; }
.main-page {
font-size: x-large;
}

BIN
lib/bld/bld-wrapper.jar Normal file

Binary file not shown.

View file

@ -0,0 +1,8 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2-SNAPSHOT
bld.extension-generated-version=com.uwyn.rife2:bld-generated-version:0.9.1-SNAPSHOT
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES,MAVEN_LOCAL
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.0

View file

@ -0,0 +1,74 @@
package rife.bld.extension;
import rife.bld.BuildCommand;
import rife.bld.Project;
import rife.bld.publish.PublishDeveloper;
import rife.bld.publish.PublishLicense;
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.Scope.*;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class TestNgOperationBuild extends Project {
public TestNgOperationBuild() {
pkg = "rife.bld.extension";
name = "bld-testng";
version = version(0, 9, 0, "SNAPSHOT");
javaRelease = 17;
downloadSources = true;
autoDownloadPurge = true;
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
var rife2 = version(1, 7, 0);
scope(compile)
.include(dependency("com.uwyn.rife2", "rife2", rife2))
.include(dependency("com.uwyn.rife2", "bld", rife2));
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"));
javadocOperation()
.javadocOptions()
.docLint(NO_MISSING)
.link("https://rife2.github.io/rife2/");
publishOperation()
// .repository(MAVEN_LOCAL)
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
.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")
.developerConnection("scm:git:git@github.com:rife2/bld-testng.git")
.url("https://github.com/rife2/bld-testng"))
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
}
public static void main(String[] args) {
new TestNgOperationBuild().start(args);
}
@BuildCommand(summary = "Runs PMD analysis")
public void pmd() throws Exception {
new PmdOperation()
.fromProject(this)
.failOnViolation(true)
.ruleSets("config/pmd.xml")
.execute();
}
}

View file

@ -0,0 +1,278 @@
package rife.bld.extension;
import rife.bld.BaseProject;
import rife.bld.operations.AbstractProcessOperation;
import java.io.File;
import java.nio.file.Files;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
/**
* Run tests with <a href="https;//testng.org/">TestNG</a>.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0
*/
@SuppressWarnings("PMD.TestClassWithoutTestCases")
public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
private static final Logger LOGGER = Logger.getLogger(TestNgOperation.class.getName());
private final List<String> args = new ArrayList<>();
private final Map<String, String> options = new ConcurrentHashMap<>();
private final List<String> packages = new ArrayList<>();
private final List<String> suites = new ArrayList<>();
private BaseProject project;
/**
* 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 parallel option).
* This can be overridden in the suite definition.
*/
public TestNgOperation dataProviderThreadCount(int count) {
options.put("-dataproviderthreadcount", String.valueOf(count));
return this;
}
/**
* The directory where the reports will be generated (defaults to {@code build/test-output}).
*/
public TestNgOperation directory(String directoryPath) {
options.put("-d", directoryPath);
return this;
}
/**
* The list of groups you want to be excluded from this run.
*/
public TestNgOperation excludeGroups(String... group) {
options.put("-excludegroups", String.join(",", group));
return this;
}
/**
* Part of the {@link #execute} operation, constructs the command list
* to use for building the process.
*
* @since 1.5
*/
@Override
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 suite or package is required.");
}
if (!options.containsKey("-d")) {
options.put("d", Path.of(project.buildDirectory().getPath(), "test-output").toString());
}
args.clear();
args.add(javaTool());
args.add("-cp");
args.add(String.format("%s:%s:%s", Path.of(project.libTestDirectory().getPath(), "*"),
project.buildMainDirectory(), project.buildTestDirectory()));
args.add("org.testng.TestNG");
options.forEach((k, v) -> {
args.add(k);
args.add(v);
});
if (!options.containsKey("-testClass")) {
try {
var temp = tempFile();
try (var bufWriter = Files.newBufferedWriter(Paths.get(temp.getPath()))) {
bufWriter.write("<suite name=\"bld Default Suite\" verbose=\"2\"><test name=\"All Packages\"><packages>");
for (var p : packages) {
bufWriter.write(String.format("<package name=\"%s\"/>", p));
}
bufWriter.write("</packages></test></suite>");
args.add(temp.getPath());
}
} catch (IOException ioe) {
LOGGER.log(Level.SEVERE, "An IO error occurred while accessing the default testng.xml file", ioe);
}
}
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info(String.join(" ", args));
}
return args;
}
/**
* Configures a PMD operation from a {@link BaseProject}.
*/
@Override
public TestNgOperation fromProject(BaseProject project) {
this.project = project;
directory(Path.of(project.buildDirectory().getPath(), "test-output").toString());
return this;
}
/**
* Whether TestNG should continue to execute the remaining tests in the suite or skip them if an @Before* method
*/
public TestNgOperation failurePolicy(FailurePolicy policy) {
options.put("-configfailurepolicy", policy.name().toLowerCase(Locale.getDefault()));
return this;
}
/**
* The list of groups you want to run (e.g. "{@code "windows", "linux", "regression}").
*/
public TestNgOperation groups(String... group) {
options.put("-groups", String.join(",", group));
return this;
}
/**
* Lets you specify method selectors on the command line.
* For example: {@code "com.example.Selector1:3", "com.example.Selector2:2"}
*/
public TestNgOperation methodSelectors(String... detector) {
options.put("-methodselectors", String.join(",", detector));
return this;
}
/**
* Lets you specify individual methods to run.
* For example: {@code "com.example.Foo.f1", "com.example.Bar.f2"}
*/
public TestNgOperation methods(String... method) {
options.put("-methods", String.join(",", method));
return this;
}
protected Map<String, String> options() {
return options;
}
/**
* The list of packages to include in this test. For example: {@code "com.example", "test.sample.*"}
* If the package name ends with .* then subpackages are included too.
*/
public TestNgOperation packages(String... name) {
packages.addAll(Arrays.stream(name).toList());
return this;
}
/**
* If specified, sets the default mechanism used to determine how to use parallel threads when running tests.
* If not set, default mechanism is not to use parallel threads at all.
* This can be overridden in the suite definition.
*/
public TestNgOperation parallel(Parallel mechanism) {
options.put("-parallel", mechanism.name().toLowerCase(Locale.getDefault()));
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"}).
*/
public TestNgOperation sourceDir(String... directory) {
options.put("-sourcedir", String.join(";", directory));
return this;
}
/**
* This specifies the suite name for a test suite defined on the command line. This option is ignored if the
* suite.xml file or the source code specifies a different suite name.
*/
public TestNgOperation suiteName(String name) {
options.put("-suitename", '"' + name + '"');
return this;
}
/**
* Specifies the suites to run. For example: {@code "testng.xml", "testng2.xml"}
*/
public void suites(String... suite) {
suites.addAll(Arrays.stream(suite).toList());
}
private File tempFile() throws IOException {
var temp = File.createTempFile("testng", ".xml");
temp.deleteOnExit();
return temp;
}
/**
* A list of class files separated by commas (e.g. {@code "org.foo.Test1","org.foo.test2"}).
*/
public TestNgOperation testClass(String... aClass) {
options.put("-testclass", String.join(",", aClass));
return this;
}
/**
* Specifies a jar file that contains test classes. If a 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 classes.
*/
public TestNgOperation testJar(String jar) {
options.put("-testjar", jar);
return this;
}
/**
* This specifies the name for a test defined on the command line. This option is ignored if the suite.xml file or
* the source code specifies a different test name.
*/
public TestNgOperation testName(String name) {
options.put("-testname", '"' + name + '"');
return this;
}
/**
* Only tests defined in a {@code <test>} tag matching one of these names will be run.
*/
public TestNgOperation testNames(String... name) {
options.put("-testnames", Arrays.stream(name).map(s -> '"' + s + '"').collect(Collectors.joining(",")));
return this;
}
/**
* This sets the default maximum number of threads to use for running tests in parallel. It will only take effect
* if the parallel mode has been selected (for example, with the -parallel option). This can be overridden in the
* suite definition.
*/
public TestNgOperation threadCount(int count) {
options.put("-threadcount", String.valueOf(count));
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.
*/
public TestNgOperation xmlPathInJar(String path) {
options.put("-xmlpathinjar", path);
return this;
}
/**
* Parallel Mechanisms
*/
public enum Parallel {
METHODS, TESTS, CLASSES
}
/**
* Failure Policies
*/
public enum FailurePolicy {
SKIP, CONTINUE
}
}

View file

@ -0,0 +1,132 @@
package rife.bld.extension;
import org.junit.jupiter.api.Test;
import rife.bld.Project;
import rife.bld.operations.exceptions.ExitStatusException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
/**
* Implements the TestNgOperationTest class.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class TestNgOperationTest {
private static final String BAR = "bar";
private static final String FOO = "foo";
@Test
void testClass() {
var op = new TestNgOperation().testClass(FOO, BAR);
assertThat(op.options().get("-testclass")).isEqualTo(String.format("%s,%s", FOO, BAR));
}
@Test
void testDataProviderThreadCount() {
var op = new TestNgOperation().dataProviderThreadCount(1);
assertThat(op.options().get("-dataproviderthreadcount")).isEqualTo("1");
}
@Test
void testDirectory() {
var op = new TestNgOperation().directory(FOO);
assertThat(op.options().get("-d")).isEqualTo(FOO);
}
@Test
void testExcludeGroups() {
var op = new TestNgOperation().excludeGroups(FOO, BAR);
assertThat(op.options().get("-excludegroups")).isEqualTo(String.format("%s,%s", FOO, BAR));
}
@Test
void testExecute() {
assertThatThrownBy(() ->
new TestNgOperation().fromProject(new Project()).packages("com.example.*").execute())
.isInstanceOf(ExitStatusException.class);
}
@Test
void testFailurePolicy() {
var op = new TestNgOperation().failurePolicy(TestNgOperation.FailurePolicy.CONTINUE);
assertThat(op.options().get("-configfailurepolicy")).isEqualTo("continue");
op = new TestNgOperation().failurePolicy(TestNgOperation.FailurePolicy.SKIP);
assertThat(op.options().get("-configfailurepolicy")).isEqualTo("skip");
}
@Test
void testGroups() {
var op = new TestNgOperation().groups(FOO, BAR);
assertThat(op.options().get("-groups")).isEqualTo(String.format("%s,%s", FOO, BAR));
}
@Test
void testJar() {
var op = new TestNgOperation().testJar(FOO);
assertThat(op.options().get("-testjar")).isEqualTo(FOO);
}
@Test
void testMethodDetectors() {
var op = new TestNgOperation().methodSelectors(FOO, BAR);
assertThat(op.options().get("-methodselectors")).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));
}
@Test
void testName() {
var op = new TestNgOperation().testName(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));
}
@Test
void testParallel() {
var op = new TestNgOperation().parallel(TestNgOperation.Parallel.TESTS);
assertThat(op.options().get("-parallel")).isEqualTo("tests");
op = new TestNgOperation().parallel(TestNgOperation.Parallel.METHODS);
assertThat(op.options().get("-parallel")).isEqualTo("methods");
op = new TestNgOperation().parallel(TestNgOperation.Parallel.CLASSES);
assertThat(op.options().get("-parallel")).isEqualTo("classes");
}
@Test
void testSourceDir() {
var op = new TestNgOperation().sourceDir(FOO, BAR);
assertThat(op.options().get("-sourcedir")).isEqualTo(String.format("%s;%s", FOO, BAR));
}
@Test
void testSuiteName() {
var op = new TestNgOperation().suiteName(FOO);
assertThat(op.options().get("-suitename")).isEqualTo("\"" + FOO + '\"');
}
@Test
void testThreadCount() {
var op = new TestNgOperation().threadCount(1);
assertThat(op.options().get("-threadcount")).isEqualTo("1");
}
@Test
void testXmlPathInJar() {
var op = new TestNgOperation().xmlPathInJar(FOO);
assertThat(op.options().get("-xmlpathinjar")).isEqualTo(FOO);
}
}