scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.09k stars 331 forks source link

Cannot run TestNG tests. #6826

Open charlesbthomas opened 2 weeks ago

charlesbthomas commented 2 weeks ago

Describe the bug

When using my editor to try and run tests I have no code lenses for any tests using the TestNG test framework.

Furthermore, when I try to run all tests in a file, there are no tests detected.

Expected behavior

Operating system

macOS

Editor/Extension

Nvim (nvim-metals)

Version of Metals

1.3.5

Extra context or search terms

No response

tgodzik commented 2 weeks ago

Thanks for reporting! Do you maybe have a sample project that I could use to reproduce it?

charlesbthomas commented 2 weeks ago

@tgodzik I will work on putting one together!

charlesbthomas commented 2 weeks ago

@tgodzik Here is an example repo that replicates the issue.

https://github.com/charlesbthomas/testng-example

Screenshots:

Working code lens on the app:

Screenshot 2024-10-09 at 9 30 19 PM

No code lens on the tests:

Screenshot 2024-10-09 at 9 30 45 PM
charlesbthomas commented 2 weeks ago

I am not familiar with the metals codebase (just a happy user), but my hunch is that we need to implement something like:

https://github.com/scalameta/metals/blob/2c8d344da6dc8b4e920612e4336b28a493f021d0/metals/src/main/scala/scala/meta/internal/metals/testProvider/frameworks/JunitTestFinder.scala#L13

but for TestNG.

tgodzik commented 2 weeks ago

Sure, but without it it should still be possible to run the whole test suite.

charlesbthomas commented 2 weeks ago

Sure, but without it it should still be possible to run the whole test suite.

If you pull that example down, you can see that it is unable to run all the tests in that file.

tgodzik commented 2 weeks ago

That's what I mean, we need to fix that part fist.