microsoft / microsoft/vscode-java-test

Support TestNG class level annotations

Open
#1,133 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged bug enhancement low-priority test-discovery testng
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 19h
Merged PRs (30d)
18

Description

Consider adding support for TestNG class level annotations.

https://testng.org/doc/documentation-main.html#class-level

With TestNG the @Test annotation can be placed on a class instead of the method. In this case all public void methods are considered tests even if they are not annotated.

Example:

@Test
public class TestNGTest {

  public void test1() {
    System.out.println("Test 1");
  }

  public void test2() {
      System.out.println("Test 2");
  }

  private void privateMethod() {
    System.out.println( "Not a test" );
  }
}

Currently there does not appear to be any way to run a test unless it is explicitly annotated. Right clicking and selecting Run just pops up an alert with No tests in file: .... No code lens appear at either class or method level. No tests appear under the class in the Test panel.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TestNG class-level annotation documentation linked in the issue and reproduce the reported "No tests in file" behavior using the Java example. Locate the existing TestNG test-discovery entry point and add coverage for public methods inherited from a class-level @Test while excluding private methods. Done means the tests run and appear in code lenses and the Test panel.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.