End to end integration test for multiple spring boot applications under Maven

前端 未结 3 1603
小鲜肉
小鲜肉 2021-02-01 19:47

What is the recommended way of running an end to end integration test for multiple Spring boot applications in the Maven build\'s verify phase?

3条回答
  •  旧时难觅i
    2021-02-01 20:17

    For certain reasons, I decided to use the second approach and had a similar problem to solve. I came up with a combination of maven-dependency-plugin and process-exec-maven-plugin.

    So assume we have some applications (e.g. app_A, app_B, ...) and a module T where the tests are implemented.

    The idea was to copy applications to local build directory and start them, before starting tests. After test run the applications will be stopped.

    To achieve this I added in module Ts pom the following build-configurations

    
      ...
      
        
        org.apache.maven.plugins
        maven-dependency-plugin
        3.1.2
        
          
            copy-app-A
            
              copy
            
            
            
              
                
                  ${project.groupId}
                  app_a
                  ${project.version}
                  ${project.build.directory}
                  app_a.jar
                
              
            
          
          
        
      
      
        
        com.bazaarvoice.maven.plugins
        process-exec-maven-plugin
        0.9
        
          
            
            start-external-server
            
            
              start
            
            
              run-app-A
              
                java
                -jar
                ${project.build.directory}/app_a.jar
              
            
          
          
            
            stop-server
            
            
              stop-all
            
          
        
      
      ...
    
    

    For a working example I created a simple project.

提交回复
热议问题