Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions java/java.j2seproject/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test.unit.run.cp.extra=${tools.jar}
test-unit-sys-prop.test.bridge.jar=${netbeans.dest.dir}/${nb.cluster.extide.dir}/ant/nblib/bridge.jar
test-unit-sys-prop.test.ant.home=${netbeans.dest.dir}/${nb.cluster.extide.dir}/ant
test-unit-sys-prop.test.junit.jar=${nb_all}/platform/libs.junit4/external/junit-4.13.2.jar
test-unit-sys-prop.test.testng.jar=${nb_all}/platform/libs.testng/external/testng-6.14.3.jar
test-unit-sys-prop.test.jcommander.jar=${nb_all}/platform/libs.testng/external/jcommander-1.78.jar
test-unit-sys-prop.test.testng.jar=${nb_all}/platform/libs.testng/external/testng-7.11.0.jar
test-unit-sys-prop.test.jcommander.jar=${nb_all}/platform/libs.testng/external/jcommander-1.85.jar
extra.module.files=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
jnlp.indirect.jars=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar

Expand Down
4 changes: 4 additions & 0 deletions java/testng.ant/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
<test-dependencies>
<test-type>
<name>unit</name>
<test-dependency>
<code-name-base>org.netbeans.insane</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.libs.junit4</code-name-base>
<compile-dependency/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.regex.Pattern;
import org.testng.reporters.VerboseReporter;

/**
* Utility class providing various parsing routines for parsing TestNG output.
Expand All @@ -49,7 +48,7 @@ final class RegexpUtils {
static final String TEST_REGEX = "[^\"]*\"([^\"]+)\" - ([^\\(]+)(\\(([^\\)]*)\\)([^:]+: (.*)\\))?( finished in (\\d+) ms)?)?( \\((\\d+) of (\\d+)\\))?( success: (\\d+)%)?";
static final String TEST_REGEX_2 = "[^\"]*\"([^\"]+)\" - ([^\\(]+)(\\(([^\\)]*)\\))(.)*";
static final String TEST_REGEX_3 = "(.)*( \\((\\d+) of (\\d+)\\))$";
static final String STATS_REGEX = "\\D+(\\d+)\\D+(\\d+)(\\D+(\\d+))?";
static final String STATS_REGEX = "\\D+(\\d+)\\D+(\\d+)(\\D+((?:\\d+)|(?:\\[.*\\])))?";

/** */
static final String TESTSUITE_PREFIX = "[TestNGAntTask]";//"Testsuite: "; //NOI18N
Expand Down Expand Up @@ -141,7 +140,7 @@ final class RegexpUtils {
+ XML_SPACE_REGEX + '*' + "\\?>"; //NOI18N

/** */
static final String TEST_LISTENER_PREFIX = VerboseReporter.LISTENER_PREFIX;
static final String TEST_LISTENER_PREFIX = "[TestNG] "; //NOI18N
/** */
static final String TESTS_COUNT_PREFIX = "tests to run: "; //NOI18N
/** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ void verboseMessageLogged(final AntEvent event) {
private long elapsedTime = 0;
// TestNG version > 6.5.2 does not by default add the org.testng.reporters.VerboseReporter listener to the testng task,
// see https://github.com/cbeust/testng/commit/6fc192911c8c58f38583a657c1edac20e6508004
// This brakes the "Test" project action as the TestNGAntLogger does not get notified about any output. This leads to
// Further, TestNG version >= 7.0.0 adds the org.testng.reporters.VerboseReporter listener to the testng task
// only when "-verbose" > 4.
// This breaks the "Test" project action as the TestNGAntLogger does not get notified about any output. This leads to
// waiting to read the results from the build/test/results/testng-results.xml file, which leads to no on-line results
// visualization in the Test Results Window. So, the org.testng.reporters.VerboseReporter listener is added to build-impl.xsl
// file for all project types. This fixes the "Test" project action for TestNG version > 6.5.2 but produces dublicate output
// file for all project types by setting verbose = 5. This fixes the "Test" project action for TestNG version > 6.5.2 but produces dublicate output
// for version <= 6.5.2 that need to be escaped. This will happen if old project uses "Dedicated Folder for Storing Libraries",
// which means that the testng dependency for that project will not be automatically updated while the build-impl.xml file will.
// These two new variables come to the rescue.
Expand Down Expand Up @@ -297,7 +299,22 @@ synchronized void verboseMessageLogged(String msg) {
if (m.matches()) {
suiteStat.testRun = Integer.valueOf(m.group(1));
suiteStat.testFail = Integer.valueOf(m.group(2));
suiteStat.testSkip = Integer.valueOf(m.group(4));
String skipGroup = m.group(4);
if (skipGroup.startsWith("[") && skipGroup.endsWith("]")) {
if (skipGroup.length() == 2) {
suiteStat.testSkip = 0;
} else {
int idx = 0;
int count = 0;
// Count end parenthesis of method signature, followed by starting brace of priority, parameters etc.
while ((idx = skipGroup.indexOf(")[pri:", idx)) > 0) {
count++;
}
suiteStat.testSkip = count;
}
} else {
suiteStat.testSkip = Integer.parseInt(skipGroup);
}
} else {
assert false : "Cannot match: '" + in + "'.";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<filename name="@{testincludes}"/>
</fileset>
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
<testng mode="mixed" classfilesetref="mixed.tests" workingDir="${basedir}" failureProperty="tests.failed" outputdir="${build.test.results.dir}">
<testng mode="mixed" classfilesetref="mixed.tests" workingDir="${basedir}" failureProperty="tests.failed" outputdir="${build.test.results.dir}" verbose="5">
<classpath>
<pathelement path="${run.test.classpath}"/>
<pathelement path="${j2ee.platform.classpath}"/>
Expand All @@ -65,7 +65,7 @@
<attribute name="testSuite" default="${build.dir}/generated/testng/temp-testng-customsuite.xml"/>
<sequential>
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
<testng workingDir="${basedir}" failureProperty="tests.failed" outputdir="${build.test.results.dir}">
<testng workingDir="${basedir}" failureProperty="tests.failed" outputdir="${build.test.results.dir}" verbose="5">
<classpath>
<pathelement path="${run.test.classpath}"/>
<pathelement path="${j2ee.platform.classpath}"/>
Expand Down Expand Up @@ -189,7 +189,7 @@
<jvmarg value="-ea"/>
<arg line="-mixed"/>
<arg line="-d ${build.test.results.dir}"/>
<arg line="-listener org.testng.reporters.VerboseReporter"/>
<arg line="-verbose 5"/>
<arg line="${test.name.arg}"/>
<arg line="${test.class.or.method}"/>
</customize>
Expand Down
77 changes: 77 additions & 0 deletions java/testng.ant/test/unit/data/antOut/log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: package com.sun.java.swing.plaf.windows not in java.desktop
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: package sun.awt.X11 not in java.desktop
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: package com.sun.java.swing.plaf.gtk not in java.desktop
WARNING: Unknown module: jdk.compiler specified to --add-opens
WARNING: Unknown module: jdk.compiler specified to --add-opens
java.io.FileNotFoundException: netbeans/java/testng/build/test/unit/results/test (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
at org.testng.xml.internal.Parser.parse(Parser.java:151)
at org.testng.xml.internal.Parser.parse(Parser.java:241)
at org.testng.TestNG.parseSuite(TestNG.java:330)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:394)
at org.testng.TestNG.initializeEverything(TestNG.java:1059)
at org.testng.TestNG.run(TestNG.java:1071)
at org.testng.TestNG.privateMain(TestNG.java:1430)
at org.testng.TestNG.main(TestNG.java:1394)
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
[TestNG] RUNNING: Suite: "UnitTest" containing "3" Tests (config: null)
[TestNG] INVOKING: "UnitTest" - org.netbeans.modules.testng.api.XmlOutputParserTest.testParseSimpleXmlOutput()
Nov 11, 2025 2:07:39 AM org.netbeans.modules.masterfs.watcher.Watcher getNotifierForPlatform
INFO: Native file watcher is disabled
[TestNG] PASSED: "UnitTest" - org.netbeans.modules.testng.api.XmlOutputParserTest.testParseSimpleXmlOutput() finished in 22010 ms
[TestNG] INVOKING: "UnitTest" - org.netbeans.modules.testng.api.XmlOutputParserTest.testParseXmlOutput()
[TestNG] PASSED: "UnitTest" - org.netbeans.modules.testng.api.XmlOutputParserTest.testParseXmlOutput() finished in 600 ms
[TestNG] INVOKING: "UnitTest" - org.netbeans.modules.testng.api.XmlOutputParserTest.testParseXmlOutput2()
[TestNG] PASSED: "UnitTest" - org.netbeans.modules.testng.api.XmlOutputParserTest.testParseXmlOutput2() finished in 505 ms
===== Invoked methods
XmlOutputParserTest.testParseSimpleXmlOutput()[pri:0, instance:UnitTest(org.netbeans.modules.testng.api.XmlOutputParserTest)]
XmlOutputParserTest.testParseXmlOutput()[pri:0, instance:UnitTest(org.netbeans.modules.testng.api.XmlOutputParserTest)]
XmlOutputParserTest.testParseXmlOutput2()[pri:0, instance:UnitTest(org.netbeans.modules.testng.api.XmlOutputParserTest)]
=====
[TestNG]
[TestNG] ===============================================
[TestNG] UnitTest
[TestNG] Tests run: 3, Failures: 0, Skips: []
[TestNG] ===============================================
PASSED: org.netbeans.modules.testng.api.XmlOutputParserTest.testParseXmlOutput
PASSED: org.netbeans.modules.testng.api.XmlOutputParserTest.testParseXmlOutput2
PASSED: org.netbeans.modules.testng.api.XmlOutputParserTest.testParseSimpleXmlOutput

===============================================
UnitTest
Tests run: 3, Failures: 0, Skips: 0
===============================================


===============================================
org.netbeans.modules.testng
Total tests run: 3, Passes: 3, Failures: 0, Skips: 0
===============================================

6 changes: 5 additions & 1 deletion java/testng.ui/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.11</specification-version>
<specification-version>1.46</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down Expand Up @@ -424,6 +424,10 @@
<code-name-base>org.netbeans.modules.java.lexer</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.java.j2seplatform</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.java.project</code-name-base>
<compile-dependency/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ public static int[] getSuiteLocation(FileObject suiteFile, String suiteName) {
r.parse(new InputSource(suiteFile.getInputStream()));
location[0] = sl.getLine();
location[1] = sl.getColumn();
} catch (IOException ex) {
LOGGER.log(Level.WARNING, null, ex);
} catch (SAXException ex) {
} catch (IOException | SAXException ex) {
LOGGER.log(Level.WARNING, null, ex);
}
return location;
Expand All @@ -66,15 +64,15 @@ public void setDocumentLocator(Locator locator) {
}

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if ("test".equals(qName) && attributes != null && suite.equals(attributes.getValue("name"))) {
line = loc.getLineNumber();
column = loc.getColumnNumber() - suite.length() - 3;
}
}

@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
public void endElement(String uri, String localName, String qName) {
}

public int getLine() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.source.SourceUtilsTestUtil;
import org.netbeans.api.java.source.TestUtilities;
import org.netbeans.junit.NbTestCase;
import org.netbeans.modules.java.JavaDataLoader;
import org.netbeans.modules.java.source.BootClassPathUtil;
import org.netbeans.spi.java.classpath.ClassPathProvider;
import org.netbeans.spi.java.classpath.PathResourceImplementation;
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
Expand Down Expand Up @@ -62,7 +58,7 @@ public ClassPath findClassPath(FileObject file, String type) {
return ClassPathSupport.createClassPath(new FileObject[0]);
}
if (type.equals(ClassPath.BOOT)) {
return createClassPath(System.getProperty("sun.boot.class.path"));
return BootClassPathUtil.getBootClassPath();
}
return null;
}
Expand All @@ -80,20 +76,6 @@ protected FileObject getTestFO() {
return testFO;
}

private static ClassPath createClassPath(String classpath) {
StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
List<PathResourceImplementation> list = new ArrayList<PathResourceImplementation>();
while (tokenizer.hasMoreTokens()) {
String item = tokenizer.nextToken();
File f = FileUtil.normalizeFile(new File(item));
URL url = getRootURL(f);
if (url != null) {
list.add(ClassPathSupport.createResource(url));
}
}
return ClassPathSupport.createClassPath(list);
}

private static URL getRootURL(File f) {
URL url = null;
try {
Expand Down
2 changes: 1 addition & 1 deletion java/testng/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.0</specification-version>
<specification-version>1.46</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
10 changes: 6 additions & 4 deletions java/testng/src/org/netbeans/modules/testng/resources/testng.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@
<localizing-bundle>org.netbeans.modules.testng.Bundle</localizing-bundle>
<volume>
<type>classpath</type>
<resource>jar:nbinst://org.netbeans.libs.testng/modules/ext/testng-6.14.3.jar!/</resource>
<resource>jar:nbinst://org.netbeans.libs.testng/modules/ext/jcommander-1.78.jar!/</resource>
<resource>jar:nbinst://org.netbeans.libs.testng/modules/ext/testng-7.11.0.jar!/</resource>
<resource>jar:nbinst://org.netbeans.libs.testng/modules/ext/jcommander-1.85.jar!/</resource>
<resource>jar:nbinst://org.netbeans.libs.testng/modules/ext/slf4j-api-2.0.17.jar!/</resource>
<resource>jar:nbinst://org.netbeans.libs.testng/modules/ext/testng-ant-1.0.0.jar!/</resource>
</volume>
<volume>
<type>javadoc</type>
<resource>jar:nbinst://org.netbeans.libs.testng/docs/testng-6.13.1-javadoc.jar!/</resource>
<resource>jar:nbinst://org.netbeans.libs.testng/docs/testng-7.11.0-javadoc.jar!/</resource>
</volume>
<properties>
<!-- please check with mkleint@netbeans.org before/after updating this or "classpath" section -->
<property>
<name>maven-dependencies</name>
<value>org.testng:testng:6.14.3:jar</value>
<value>org.testng:testng:7.11.0:jar</value>
</property>
</properties>
</library>
Loading
Loading