No tests written

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:

12:51:56 Writing tests for: PatientHauptArztrolleUndBehandlungsortService.insert(Patient, Arztrolle, Behandlungsort)

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

Logs are:
support-20231206T124933.log (242.0 KB)
user-20231206T124933.log (199.1 KB)

Any idea what is wrong?

Hi @Guido

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?

Kind regards,
Jane @ Diffblue

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 :face_with_peeking_eye: 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.

Kind regards,
Jane @ Diffblue

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.

1 Like

hi @Jane_Walls
I’m also facing the same issue while trying to use Diffblue to generate tests.
user-20240507T145448.log (16.9 KB)
cover-server.log (1.1 KB)
support-20240507T145448.log (59.4 KB)

I have attached all the log files for your reference, kindly suggest what is causing the error R024: Diffblue AI was unable to find a test.

Regards
Shivangi

Hi @ShivangiP20

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.

Best regards
Peter Sear @ Diffblue