Log print Reason: R026 Failed to create Spring context.
// Attempt to initialize test context failed with
Why diffblue need create Spring context? If generate unit test, I think it doesn’t need spring context.
And why only generate @Autowired member bean. not generate @Mock bean.
Hi Steven,
Thank you for contacting Diffblue Support. Diffblue needs the Spring context in order to write Java unit tests which involve Spring functionality. We have a getting-started guide in our blog collection: Getting Started with Spring Boot and Diffblue Cover | Diffblue
It would be useful to upload the log file of your run. We have a dedicated page for the R026 code which you see:
Working with code R026 | Diffblue Docs
Most probably Diffblue Cover cannot find a Spring profile. Please see some details here: Spring profiles | Diffblue Docs
I would suggest trying to overcome the R026 reason code by making your Spring profile visible. An example can be seen here: https://www.baeldung.com/spring-profiles
After that, we can review the following question about annotations, if it still persists.
Please let us know if you need more help with this issue.
Kind Regards.
Cristian