How to disable deploying process for test purposes?

Hello,

I encountered the same issue while I was trying to run Spring Boot’s @WebMvcTest tests.

The solution I came up with is instead of annotating the main application class with @EnableProcessApplication just add an additional config class alongside the main application class that is enabled only when property camunda.bpm.enabled is true or missing.

Please find below the code.

/**
 * This class makes it possible to completely disable Camunda via a corresponding property.
 *
 * <p>To disable this configuration, set property {@code camunda.bpm.enabled} to {@code false}.</p>
 */
@Configuration
@EnableProcessApplication
@ConditionalOnProperty(name = "camunda.bpm.enabled", havingValue = "true", matchIfMissing = true)
public class CamundaProcessApplicationConfig {

}

Having this code in place, unit tests and Spring Boot test slices don’t see this additional config class by default, and for full-blown integration tests it’s possible to disable Camunda by providing
@TestPropertySource("camunda.bpm.enabled=false").

I hope this will be helpful.

1 Like