Flowable Deploying but no processes or endpoints

I am creating integration tests for flowable 6.4 and the engine is deploying but I don’t have any processes or endpoints where the normal deployed application does.

@WebAppConfiguration
@AutoConfigureMockMvc
@ContextConfiguration(classes = IntegrationConfiguration.class)
@Profile("dev")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@ExtendWith(FlowableSpringExtension.class)
public class FlowableIntegrationSmokeTest{

  @Autowired
  private WebApplicationContext wac;
  private MockMvc mockMvc;
  @Autowired
  RepositoryService repoService;
  @Autowired
  ProcessEngine processEngine;
  @Autowired
  RuntimeService runtimeService;
  @Autowired
  HistoryService historyService;

  @BeforeEach
  public void servicesSetUp() throws Exception {
    MockitoAnnotations.initMocks(this);
  }

  @Test
  void testA() throws Exception {
    this.mockMvc = webAppContextSetup(this.wac).build();

    System.out.println("Definitions names : "
        + repoService.createProcessDefinitionQuery().list().stream().map(ProcessDefinition::getKey).collect(Collectors.joining()));
    
    List<ProcessDefinition> processDefinitions = processEngine.getRepositoryService().createProcessDefinitionQuery().listPage(0,5);
    System.out.println("Process Definition List size: "+ processDefinitions.size());
    for (ProcessDefinition processDefinition : processDefinitions) {
      String deploymentId = processDefinition.getDeploymentId();
      System.out.println("Deployment ID for definition: "+ deploymentId);
    }

    MvcResult result = mockMvc.perform(get("/engine/provisioning/new").contentType(ApiVersion.V1)
        .accept(ApiVersion.V1)
        .content("{}")).andExpect(status().isAccepted()).andReturn();
    System.out.println(result.getResponse().getContentAsString());
  }

  @Test
  void testB() {
    historyService.createHistoricProcessInstanceQuery().list().forEach(s -> {
      System.out.println(s.getId());
    });
  }
}

This is my test file the output of the printed lines are:

Definitions names : 
Process Definition List size: 0

The context configuration IntegrationConfiguration looks like:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.stereotype.Component;

import com.pgi.flowable.autoconfiguration.FlowzillaAutoConfiguration;
import com.pgi.flowzilla.boot.FlowzillaApplication;
import com.pgi.flowzilla.config.UnitTestConfiguration;

/**
 *
 */
@Component
public class IntegrationConfiguration {

  @Profile("dev")
  @Configuration
  @PropertySources({ @PropertySource("classpath:application-dev.properties")})
  static class DevConfiguration implements TestConfiguration {
  }

  @Profile("qab")
  @Configuration
  @PropertySources({ @PropertySource("classpath:application-dev.properties")})
  static class QabConfiguration implements TestConfiguration {
  }
   
  @SpringBootApplication(scanBasePackages = "com.pgi.flowzilla", exclude = {FlowzillaAutoConfiguration.class })
  static class TestApplication {
      public static void main(String[] args) {
      SpringApplication.run(FlowzillaApplication.class, args);
    }
  }
}

the application-dev.properties looks like:

spring.liquibase.enabled=false
server.servlet.context-path=/engine

It looks like you have read the Flowable docs on unit testing with Spring, though you might be missing @ExtendWith(FlowableSpringExtension.class).

The code would be much more readable if they were inside code blocks (three back-ticks (`) before and after the code).

Thanks for your advice. I have fixed the code to be more readable. The extends didn’t help much. So I updated the code above with the proposed solution and now the console is reading java.lang.IllegalArgumentException: WebApplicationContext is required
at org.springframework.util.Assert.notNull(Assert.java:198)
at org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder.(DefaultMockMvcBuilder.java:52)
at org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup(MockMvcBuilders.java:51)
at com.pgi.flowzilla.FlowableIntegrationSmokeTest.testA(FlowableIntegrationSmokeTest.java:107)

Did you try with both @ExtendWith lines as indicated in the docs?

@ExtendWith(FlowableSpringExtension.class)
@ExtendWith(SpringExtension.class)

I did and that error went away but I still don’t have anything deployed out. No endpoints and no processes. Do I need to specify @Deployment with a process?

Edit:

So I added @Deployment(resources = {“processes/NewUser.bpmn20.xml”})
and it did deploy the process. However I am still not seeing the endpoints that I need to test. So I am close. Any suggestion would be great.

'@Deployment` will deploy a process and clean up after itself when the test is over (to prevent side effects). If no resource is specified there is a naming convention (looking for the docs). I think the issue was the leading slash.

The issue with the endpoints is not Flowable specific, but I wonder if the MockMVC respects the context root. Do you get it if you strip off the /engine from the URL?

You sir are a scholar and a saint. Thank you very much. The /engine was the cause of my not finding the endpoints. I believe that should be all I need. Also which leading slash do you mean?

The one before processes:
image

Gotcha yeah that was an issue