feat(run): recognize TestNG classes annotated with @Test (#1403)

TestNG's class-level @Test makes the class's public void methods tests; the scanner now recognizes them (excluding @Before*/@After*/@DataProvider/@Factory). Test results locate TestNG failures past org.testng frames and parse TestNG's comparison message. Refs #1368
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-05 08:59:49 +08:00
1 джерело 1f70b134de
коміт 01e09565b7
6 files changed
+65 -2

No files matched your search

+25
Переглянути файл
@@ -94,6 +94,31 @@ describe("scanJvmTargets (Java)", () => {
[16, "test", "a.b.OrderTest$Fixture", "inner", false],
]);
});
it("treats the public void methods of a TestNG class-level @Test as tests", () => {
const src = [
"package a.b;", // 0
"import org.testng.annotations.*;",
'@Test(groups = "unit")',
"public class PriceTest {", // 3
" @BeforeMethod public void setUp() {}",
" public void rounds() {}", // 5
' @Test(dataProvider = "rows")',
" public void parses(String row) {}", // 7
" @DataProvider public Object[][] rows() { return null; }",
' @DataProvider(name = "more") public void notATest() {}',
" void packagePrivate() {}",
" private void util() {}",
" public static void shared() {}",
" public int value() { return 1; }",
"}",
].join("\n");
expect(pick(src, "src/test/java/a/b/PriceTest.java")).toEqual([
[3, "suite", "a.b.PriceTest", null, false],
[5, "test", "a.b.PriceTest", "rounds", false],
[7, "test", "a.b.PriceTest", "parses", false],
]);
});
});
describe("scanJvmTargets (Kotlin)", () => {