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