I am playing around with the diffblue cover plugin for the first time and tried to let it generate tests for a single Spring-Service-method.
Output in the idea-window is:
Tests written: 0
Cover was unable to write any tests for the reasons listed below.
Change what sort of tests Cover writes in Change Settings.
Methods without tests: 1
Diffblue AI was unable to find a test: 1
Thank you for reaching out and uploading the log files - I’ve had a look with our engineers and it is likely there is a bug in Cover that occurs whilst dealing with an open source library you are using (Apache Lucene). To help us recreate the issue; are you please able to share the code that triggered this?
What exactly do you want to see?
Only the method I tried to generate tests for? That would be easy.
Or do you want to see the whole environment around the method? Question here is how far this should go? This could be difficult to reach…
Maybe it’s easier you ask some specific questions or you offer suggestions what I can try to circle the problem for you.
The method should be enough, or the class is ideal if you’re able to share it as it also seems from the log file you shared that the code is complex, so any further information would be useful to us.
In any case, I will also keep looking internally if there is a way to work around this in the meantime.
The class is this: PatientHauptArztrolleUndBehandlungsortService.java (4.6 KB)
Nothing really complex…
The parameters which deal with apache lucene in other use cases are ‘Patient’ and ‘Behandlungsort’, some Attributes of this types are lucene-indexed.
In the meantime I tried to remove the parameters from the parameter-list and introduced them as local variables. By this way the tests were generated. After this I have to adjust the generated test back to the real conditions. This is only a workaround.
I hope this helps you to find a solution so the workaround above is not needed in future.
Any further questions are welcome.
The output code, R024, means that an internal process stopped unexpectedly. This is often due to a limitation of resources, in particular Java heap space. In this case, it looks reasonable at 4GB but it could be a factor. Information for setting this value for the JVM in IntelliJ can be found in the Diffblue documentation under Memory Management.
Please also check that the resources on the system in questions match the prerequisites in the Diffblue documentation.
I notice that the Java version being used is 22.0.1, which is not currently a supported release for Diffblue Cover (this will follow in the near future). It is possible this could have an impact, so I’d suggest trying an earlier supported version, such as Java 21.