vscode-java-test icon indicating copy to clipboard operation
vscode-java-test copied to clipboard

Cannot debug a TestNG test which has 'dependsOnGroups' property

Open kurbatov opened this issue 3 years ago • 3 comments

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

kurbatov avatar Jul 13 '22 11:07 kurbatov

Is it possible to provide a sample project?

jdneo avatar Jul 13 '22 12:07 jdneo

Okay, I figured out the cause of this behavior: a test method I wanted to debug inherited dependsOnGroups property from the class-level @Test annotation.

I have set up a sample project here https://github.com/kurbatov/vscode-testng Try to run or debug dependentTest in https://github.com/kurbatov/vscode-testng/blob/master/submodule/src/test/java/com/github/kurbatov/TestNGTest.java

kurbatov avatar Jul 16 '22 20:07 kurbatov

Thank you @kurbatov, I can repro it.

jdneo avatar Jul 18 '22 01:07 jdneo