As the david comments our sample code is working. But my question is that for mock and mono clasess for which notable to create test cases. Can you please help on this?
But unfortunately not able to share actual logs
Can you provide an explicit example of what you are expecting? Please provide the class definition and what you want to see in the created java test.
David @ Diffblue
David actually what happen the sample code we provide you when we keep all the classes in same folder then only able to create test cases otherwise not able to create test cases. This is the behavior?
Hi team,
For some of the service classes create only 48% coverage and skip some of the lines.
Any specific reason please let me know that can be helpful for us.
Hi,
For your first point I am able to see a R013 on your sample code but this is not an error just an explanation of why you did not get an additional test case. We still generate 100% coverage for this class so if you do not wish to see this then I suggest turning off partial tests which can be done here: Creating partial tests | Diffblue Docs.
For your second point I see 100% coverage on your sample code, but there are a number or reasons why we might not have written a test for every line in your actual code. If you could give the reason code that would help to understand why we did not generate tests.
Thanks, Thomas
Not able to create test cases for private method. Show āNot directly callableā.
As well not able to create test cases for Mono and Flux type
Can you please help on this?
This message is simply telling you that private methods cannot be unit tested directly - this is something that happens with all unit tests, not just Diffblue written unit tests. As a developer you also cannot directly test private methods (without using Reflection which is not good practice and should not be done in most cases).
Diffblue will try to cover these private methods by writing tests for the public methods that then call these private methods - so you will still get coverage.
Thanks
Matt @ Diffblue
Not able to create test cases for Mono and Flux type. Any help on this?
Hi Pooja,
I am sorry but Diffblue does not support Spring Webflux
Are you evaluating Diffblue Cover or are you using it as part of your development workflow? Is it new code you are using Diffblue Cover to write tests for or legacy code?
Thanks
Matt @ Diffblue
In future I want to use diffblue as a part of development workflow. But due to all these issues not able to proceed. IF you able to help me please let me know the solution for R013 error code as well Memo type classes
Hi Pooja,
Thanks for the explanation - as Thomas and David mention above; R013 is because your code isnāt testable for some reason - it is not an error with Diffblue therefore we cannot solve it in your code without access to your code and logs. Have you looked at the very detailed guide here: Working with code R013 | Diffblue Docs ?
Thanks
Matt @ Diffblue
Yes I go through the R013 documentation but developer donāt want to do any changes in code to resolve this issue. So can you please help on this without code and logs?
Hi Pooja,
I am sorry but there is nothing I can do as the problem is in your code and without seeing the log or the code I canāt tell you what to do
Please let us know if you have any other questions
Matt @ Diffblue
If the code isnāt callable by a test class, for example, human devs canāt write any tests for it never mind a machine! If your devs wonāt update the code then itāll stay untestable.
kindly help me the what are the specific versions it will work.
Hi,
Spring 6 isnāt supported yet ā in the works. Spring 4 and 5 are supported.
Hi Matt,
I saw your conversation with @pooja_singhani, Matt service class will have private method and classes, while in this case, there will not be any test-class right. how this will help to developer
same problem
Hi Syed,
To test private methods you must run Diffblue Cover on public methods which call private methods - this is the same if you are trying to test private methods when writing unit tests by hand. To get more tests you could make the private
methods protected
thus allowing Diffblue to write unit tests with scope to access the methods directly. Please see this comment I posted above:
Does this answer your question? Please let me know if there is anything else I can help you with
Thanks
Matthew