microsoft / microsoft/vscode-java-test

Cannot debug a TestNG test which has 'dependsOnGroups' property

Open
#1,452 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged bug investigating maven test-debugging testng
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 19h
Merged PRs (30d)
18

Description

Issue Type: Bug

Steps to reproduce:

  1. Open a maven project with TestNG tests (TestNG v. 7.6.1, surefire plugin v. 2.22.2).
  2. Try to debug a test.

Expected behaviour:
Debugger hits a breakpoint in the body of test method.

Actual behaviour:
When I click on the Debug Test button, debug session does not start.
I see the following exeption in the debug console of VSCode:

Exception occured while running tests.
java.lang.NullPointerException: Cannot invoke "org.testng.ISuiteResult.getTestContext()" because the return value of "com.microsoft.java.test.runner.testng.TestNGListener.getFirst(java.util.Collection)" is null
at com.microsoft.java.test.runner.testng.TestNGListener.onFinish(TestNGListener.java:74)
at org.testng.SuiteRunner.invokeListeners(SuiteRunner.java:269)
SuiteRunner.java:269
at org.testng.SuiteRunner.run(SuiteRunner.java:332)
SuiteRunner.java:332
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
SuiteRunnerWorker.java:52
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
SuiteRunnerWorker.java:95
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
TestNG.java:1256
at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
TestNG.java:1176
at org.testng.TestNG.runSuites(TestNG.java:1099)
TestNG.java:1099
at org.testng.TestNG.run(TestNG.java:1067)
TestNG.java:1067
at com.microsoft.java.test.runner.testng.TestNGRunner.run(TestNGRunner.java:45)
at com.microsoft.java.test.runner.testng.TestNGLauncher.execute(TestNGLauncher.java:32)
at com.microsoft.java.test.runner.Launcher.main(Launcher.java:57)

Extension version: 0.35.2
VS Code version: Code 1.69.1 (b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a, 2022-07-12T08:21:51.333Z)
OS version: Darwin x64 21.3.0
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 5, 5, 4
Memory (System) 16.00GB (0.03GB free)
Process Argv --crash-reporter-id ff59b45e-f9bf-4e90-9087-bc26b56d7a10
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
pylanb8912cf:30520717
vsclangdf:30486550

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

Reproduce the failure with a Maven TestNG project containing a test with dependsOnGroups, then start by reading TestNGListener.java around onFinish and the TestNGRunner entry shown in the stack trace. Confirm the fix by running the debug flow and verifying that it starts and reaches a breakpoint in the test method.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.