Closed oysandvik94 closed 8 months ago
Currently there is no function to run all tests. I had a look at what it would take to implement it and even have a prototype, but I'm not sure it's worth moving forward with it because it's a bit more complicated then I'd have liked.
The test-runner library used for junit/testng require at least class names to be specified and you can only run them per project. What this means is that nvim-jdtls would have to trigger 1 debug session per project and test-framework (or module, in multi-module projects).
This would then require merge-logic, and the test-result extraction logic would need to change, because it currently assumes that all results are for a single buffer.
But what makes this a bit of a deal breaker for me is that you cannot control concurrency. So for bigger projects this is likely going to be way slower than a mvn test
or gradle test
, where you can use forks.
I think a better option is to write a small tool or function that extracts the test failures from the xml files generated by mvn test
or gradle test
.
If it's a tool it could be used with :h -q
. If it's a function it could add the errors to the quickfix list, or use the diagnostic api.
That makes sense. I agree a seperate tool/plugin would be the best. I tried implementing it in a compiler plugin a while ago so that I could pipe errors to QF with errorformat, but the filenames wasn't really deterministic enough (or at least I didn't manage to parse them properly).
I did start on a tool for myself to do this, so I'll see how far I get with that. Thanks for your input!
Problem Statement
I'm sure there's a way to solve this workflow issue, but I haven't figured it out myself.
I would like to run all the tests in my project, and identity which are failing.
With the test run commands with dap, I can run tests from a specific test class, but then I have to know which test class I want to check. Sometimes I dont know which tests could break.
I love how running a test class will populate my quickfix with errors, but I would love to get this from running all tests.
Ideas or possible solutions
If there isn't a way to do this now, is it possible to create a
require'jdtls'.test_all()
method, or is this difficult?