I’m struggling to get the community IDEA plugin to generate a test. I thought I was starting with the most basic of projects by starting a new project from Spring Initializr. I’ve left the default settings apart from selecting Gradle instead of Maven for build. I’ve not selected any other dependencies.
I’ve written a simple class and tried to get Diffblue Cover to generate tests for it but get this error.
Could not start test generator because Spring Boot Test could not be found in the classpath.: We could not start Diffblue Cover because Spring Boot Test, which is documented as a requirement for Diffblue Cover, could not be found.
I’m not entirely sure what Diffblue Cover requires. In the Gradle build file it has these dependencies
When creating a project on Spring initializr, I would recommend to add Spring Web as a dependency.
The problem that you are experiencing is due to the Gradle integration in IntelliJ: it creates separate source and test modules, rather than just source and test directories, as the Maven integration does.
We are working on a fix to recognise this properly in Diffblue Cover, but as a workaround you can either switch to Maven, where the IntelliJ integration works as expected, or follow the following steps:
Create Spring project with Spring Web dependency on initializr.
Import the project in IntelliJ.
Go to File -> Project Structure -> Modules.
Select main from the module tree and select the tab Dependencies
Thanks @pkesseli
That has worked for me. I did originally have the Spring Web as a dependency but I’d tried stripping things back to the bare minimum to try and get it to work.
I’m assuming this is an issue specific to the community plugin as it is IntelliJ creating separate modules to match its project structure and wouldn’t affect the CLI tool?