apache / apache/netbeans

Tests for Ant projects no longer work with bundled TestNG libraries

Open
#9,561 2 comments 0 reactions 0 assignees View on GitHub
Ant kind:bug tests
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 31

### What happened

Using `ant test` or running individual tests in the IDE yields an error with an Ant project that uses the bundled TestNG libraries (added with `Test Dependencies` > `Add Library...`).

### Language / Project Type / NetBeans Component

Ant project using TestNG

### How to reproduce

1. Create a new Ant project (`New Project...` > `Java with Ant` > `Java Application`). Keep `Create Main Class` checked.
2. In the main class, click on the class name and select `Create Test Class [TestNG...` in the hints.
3. Test the `testMain` method.

### Did this work correctly in an earlier version?

Apache NetBeans 30

### Operating System

linux 7.1.8.arch1-3

### JDK

OpenJDK 26.0.2.u10-1

### Apache NetBeans packaging

Community provided installer, Third-party package

### Anything else

[Example project](https://github.com/user-attachments/files/31094260/Broken.TestNG.zip)

It has broken with 31 because TestNG has been bumped up to `7.11`. The current `build-impl.xml` isn't equipped to handle the new major version.

[Related to this issue](https://github.com/apache/netbeans/issues/6737).

Test output:

```
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.
Exception in thread "main" org.testng.TestNGException:
Couldn't find a constructor in class org.testng.reporters.VerboseReporter
at org.testng.internal.objects.InstanceCreator.newInstance(InstanceCreator.java:59)
at org.testng.ITestObjectFactory.newInstance(ITestObjectFactory.java:10)
at org.testng.internal.objects.SimpleObjectDispenser.dispense(SimpleObjectDispenser.java:61)
at org.testng.internal.objects.GuiceBasedObjectDispenser.dispenseObject(GuiceBasedObjectDispenser.java:41)
at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense(GuiceBasedObjectDispenser.java:31)
at org.testng.internal.DefaultListenerFactory.createListener(DefaultListenerFactory.java:29)
at org.testng.TestNG.setListenerClasses(TestNG.java:698)
at org.testng.TestNG.configure(TestNG.java:1558)
at org.testng.TestNG.privateMain(TestNG.java:1421)
at org.testng.TestNG.main(TestNG.java:1394)
```

### Are you willing to submit a pull request?

Yes

Contributor guide

Open the contributing guide

Research direction

Start with the attached Broken TestNG project and reproduce the failure using ant test and the IDE. Inspect the Ant project's generated build-impl.xml and the handling of the bundled TestNG 7.11 library, using issue 6737 for context. Done means the testMain test runs successfully from both the command line and the IDE.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.