Build executable JAR for Gatling load test

后端 未结 6 1158
感动是毒
感动是毒 2020-12-30 02:01

I am new to Gatling (2.1.2) and want to do a small prototype project to show to my colleagues.

According to the quick start page, there are several ways I can run a

6条回答
  •  情歌与酒
    2020-12-30 02:42

    I've recently blogged about this Creating a versionable, self-contained (fat-/uber-) JAR for Gatling tests, the source of which can be found in jamietanna/fat-gatling-jar.

    For a Maven project, the steps would be as follows.

    The main things you need are to add the dependency on gatling-charts-highcharts:

    
        
        
            
                io.gatling.highcharts
                gatling-charts-highcharts
                ${gatling.version}
            
        
    
    

    Next, you need to make sure your Gatling scenarios/simulations are in src/main instead of src/test.

    Finally, you can use the maven-shade-plugin to build an executable JAR which uses Gatling's CLI runner as the mainClass:

    
        
        
            
                
                  org.apache.maven.plugins
                  maven-shade-plugin
                  3.1.1
                  
                    
                      
                      
                        *:*
                        
                          META-INF/*.DSA
                          META-INF/*.SF
                          META-INF/*.RSA
                        
                      
                    
                  
                  
                    
                      package
                      
                        shade
                      
                      
                        
                          
                            io.gatling.app.Gatling
                          
                        
                      
                    
                  
                
            
        
      
    

提交回复
热议问题