Jenkins的功能强大,在于它的插件式框架,能扩展功能,自动化当中,很容易想到的是对提交的新代码做测试,这里gatling主要是负责压力测试,也就是所谓的性能。关于gatling,可以参考我前面的博文。
在jenkins下,首先要安装gatling的插件,可以直接在Jenkins>Manage Jenkins>Manage Plugins>Available下点击安装,也可以在Advance里面通过上传安装。由于我这里两个浏览器设置的代理不同,在测试jenkins的浏览器中不能直接点击Available里面的gatling安装,网络无法联通。所以,我在另外一个带有FQ代理的浏览器中,先下载了gatling.hpi(我这里是1.1.1版本)插件文件到本地。再通过advance的tab下上传文件的方式进行安装。
按照上图,只需要关注红色框部分即可,其他就默认吧,点击submit,然后将jenkins重启,gatling plugin就安装好了。
现在可以看看jenkins下的gatling是如何集成在maven项目里,做一个自动化性能测试的。还是基于前面博文的项目mueas,由于之前,mueas项目下,没有gatling的支持。所以,要在mueas工程的pom文件添加依赖和plugin的配置。
下面先看看依赖的配置:
1 <!-- Add Gatling maven plugin to support gatling startup to test performance --> 2 <dependency> 3 <groupId>io.gatling.highcharts</groupId> 4 <artifactId>gatling-charts-highcharts</artifactId> 5 <version>2.1.6</version> 6 </dependency>
再就是在pom文件的build部分添加plugin的配置:
1 <build> 2 <plugins> 3 。。。。。 #此处是其他相关的plugin的内容,省略了 4 <plugin> 5 <groupId>io.gatling</groupId> 6 <artifactId>gatling-maven-plugin</artifactId> 7 <version>2.1.6</version> 8 <configuration> #此configuration部分的配置,要结合自己的项目的结构来填写信息 9 <configFolder>src/test/resources</configFolder> 10 <dataFolder>src/test/resources/data</dataFolder> 11 <resultsFolder>target/gatling/results</resultsFolder> 12 <bodiesFolder>src/test/resources/bodies</bodiesFolder> 13 <simulationsFolder>src/test/scala</simulationsFolder> 14 </configuration> 15 <executions> 16 <execution> 17 <id>execution-1</id> 18 <goals> 19 <goal>execute</goal> 20 </goals> 21 <configuration> 22 <simulationClass>simple/MueasSimulation_Simple</simulationClass> 23 </configuration> 24 </execution> 25 <!-- Here, can repeat the above execution segment to do another test --> 26 </executions> 27 </plugin> 28 </plugins> 29 </build>
附带着将eclipse中maven工程的文件结构也展示一下:
由于gatling的压力测试脚本是基于scala语言写的,所以,目录中simulationFolder部分src/test/scala下面,是一个scala的程序。
那这里,看看这个scala脚本程序是什么样子吧,很简单:
1 package simple 2 3 import io.gatling.core.Predef._ 4 import io.gatling.http.Predef._ 5 import scala.concurrent.duration._ 6 7 class MueasSimulation extends Simulation{ 8 val httpConf = http.baseURL("http://localhost:8080") 9 10 val scn = scenario("Redirect Login Page") 11 .exec(http("Redirect Login").get("/").check(status.is(200))) 12 .pause(10 seconds) 13 .exec(http("Try Login").post("/login").formParamSeq(Seq(("username","你自己的用户名"),("password", "你自己的密码"))).check(status.is(200))) 14 .pause(10 seconds) 15 16 //setUp(scn.inject(rampUsers(10) over (60 seconds)).protocols(httpConf)) 17 setUp(scn.inject(atOnceUsers(5)).protocols(httpConf)) 18 }
mueas工程修改好了,通过git将新修改提交到远程仓库,方便jenkins管理。
到此,可以配置jenkins了,创建一个新的Job,配置基本信息可以参考前面Jenkins的基础篇,这里,主要是强调一下,关于这个gatling集成应用的配置。主要在build部分。下面这个图,主要是Pre Steps里面的Execute shell的编写,用来清除环境,主要是杀掉可能存在的应用。脚本很简单,自己看看就明白。
再就是Post Steps的配置,完成两步工作,第一步是启动mueas应用,第二步,就是启用gatling来进行压力测试。
到这里,所有的配置,关于gatling在jenkins的集成,全部完成。现在可以启动jenkins的job了。直接Build。完成后,可以看到下面的日志信息。
1 Started by user anonymous 2 Building in workspace /root/.jenkins/jobs/mueas-gatling/workspace 3 > git rev-parse --is-inside-work-tree # timeout=10 4 Fetching changes from the remote Git repository 5 > git config remote.origin.url [email protected]109.105.5.108:/data/git/mueas.git # timeout=10 6 Fetching upstream changes from [email protected]109.105.5.108:/data/git/mueas.git 7 > git --version # timeout=10 8 using GIT_SSH to set credentials root private key 9 > git -c core.askpass=true fetch --tags --progress [email protected]109.105.5.108:/data/git/mueas.git +refs/heads/*:refs/remotes/origin/* 10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 11 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 12 Checking out Revision 7ae96f26da0f7b1ff289b6008d3531872938bd17 (refs/remotes/origin/master) 13 > git config core.sparsecheckout # timeout=10 14 > git checkout -f 7ae96f26da0f7b1ff289b6008d3531872938bd17 15 > git rev-list 7ae96f26da0f7b1ff289b6008d3531872938bd17 # timeout=10 16 > git tag -a -f -m Jenkins Build #14 jenkins-mueas-gatling-14 # timeout=10 17 [workspace] $ /bin/bash /tmp/hudson3630375499244789010.sh 18 ================= PRE STEPS TRACKING BEGIN ================= 19 WORKSPACE: /root/.jenkins/jobs/mueas-gatling/workspace 20 target dir: /root/.jenkins/jobs/mueas-gatling/workspace/target 21 war file: /root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war 22 specified running instance: mueas-0.0.1-SNAPSHOT.war --server.port=8080 23 runningpid: 24 There is no running instance as specified 25 ================= PRE STEPS TRACKING END =================== 26 Parsing POMs 27 [workspace] $ /usr/java/jdk1.8.0_65/bin/java -cp /root/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/usr/local/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/usr/local/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven31Main /usr/local/apache-maven-3.3.3 /root/.jenkins/war/WEB-INF/lib/remoting-2.53.2.jar /root/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /root/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 44372 28 <===[JENKINS REMOTING CAPACITY]===>???channel started 29 Executing Maven: -B -f /root/.jenkins/jobs/mueas-gatling/workspace/pom.xml -s /root/.m2/settings.xml -gs /usr/local/apache-maven-3.3.3/conf/settings.xml package -Dmaven.test.skip=true 30 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects... 31 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 32 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 33 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building mueas 0.0.1-SNAPSHOT 34 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 35 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 36 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-resources-plugin:2.6:resources (default-resources) @ mueas --- 37 [pool-1-thread-1 for channel] INFO org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering - Using ‘UTF-8‘ encoding to copy filtered resources. 38 [pool-1-thread-1 for channel] INFO org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering - Copying 0 resource 39 [pool-1-thread-1 for channel] INFO org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering - Copying 863 resources 40 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 41 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-compiler-plugin:3.1:compile (default-compile) @ mueas --- 42 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.compiler.CompilerMojo - Nothing to compile - all classes are up to date 43 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 44 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-resources-plugin:2.6:testResources (default-testResources) @ mueas --- 45 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.resources.TestResourcesMojo - Not copying test resources 46 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 47 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mueas --- 48 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.compiler.TestCompilerMojo - Not compiling test sources 49 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 50 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-surefire-plugin:2.17:test (default-test) @ mueas --- 51 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.surefire.SurefirePlugin - Tests are skipped. 52 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 53 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-war-plugin:2.5:war (default-war) @ mueas --- 54 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.war.WarMojo - Packaging webapp 55 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.war.WarMojo - Assembling webapp [mueas] in [/root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT] 56 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.war.WarMojo - Processing war project 57 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.war.WarMojo - Copying webapp resources [/root/.jenkins/jobs/mueas-gatling/workspace/src/main/webapp] 58 [pool-1-thread-1 for channel] INFO org.apache.maven.plugin.war.WarMojo - Webapp assembled in [740 msecs] 59 [pool-1-thread-1 for channel] INFO org.codehaus.plexus.archiver.war.WarArchiver - Building war: /root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war 60 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - 61 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- spring-boot-maven-plugin:1.2.7.RELEASE:repackage (default) @ mueas --- 62 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 63 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD SUCCESS 64 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 65 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 11.367 s 66 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-01-21T16:37:44+08:00 67 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 23M/315M 68 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 69 [JENKINS] Archiving /root/.jenkins/jobs/mueas-gatling/workspace/pom.xml to com.tinguish/mueas/0.0.1-SNAPSHOT/mueas-0.0.1-SNAPSHOT.pom 70 [JENKINS] Archiving /root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war to com.tinguish/mueas/0.0.1-SNAPSHOT/mueas-0.0.1-SNAPSHOT.war 71 [workspace] $ /bin/bash /tmp/hudson1486991218168918628.sh 72 channel stopped 73 ================= POST STEPS TRACKING BEGIN ================= 74 WORKSPACE: /root/.jenkins/jobs/mueas-gatling/workspace 75 target dir: /root/.jenkins/jobs/mueas-gatling/workspace/target 76 war file: /root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war 77 BEGIN TO DO GATLING SIMULATION.... 78 SLF4J: Class path contains multiple SLF4J bindings. 79 SLF4J: Found binding in [jar:file:/root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war!/WEB-INF/lib/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] 80 SLF4J: Found binding in [jar:file:/root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war!/WEB-INF/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class] 81 SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 82 SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 83 84 . ____ _ __ _ _ 85 /\\ / ___‘_ __ _ _(_)_ __ __ _ \ \ \ 86 ( ( )\___ | ‘_ | ‘_| | ‘_ \/ _` | \ \ \ 87 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 88 ‘ |____| .__|_| |_|_| |_\__, | / / / / 89 =========|_|==============|___/=/_/_/_/ 90 :: Spring Boot :: (v1.2.7.RELEASE) 91 92 2016-01-21 16:37:46.843 INFO 23716 --- [ main] com.tinguish.mueas.Application : Starting Application on CloudGame with PID 23716 (started by root in /root/.jenkins/jobs/mueas-gatling/workspace) 93 2016-01-21 16:37:46.980 INFO 23716 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]1e76c2be: startup date [Thu Jan 21 16:37:46 CST 2016]; root of context hierarchy 94 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects... 95 2016-01-21 16:37:48.032 WARN 23716 --- [ main] .i.s.PathMatchingResourcePatternResolver : Skipping [/root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war] because it does not denote a directory 96 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 97 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 98 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building mueas 0.0.1-SNAPSHOT 99 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 100 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 101 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- gatling-maven-plugin:2.1.6:execute (default-cli) @ mueas --- 102 103 此部分省略。。。。。。。。。。。。。。 104 105 2016-01-21 16:38:07.615 INFO 23716 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 106 2016-01-21 16:38:07.625 INFO 23716 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647 107 2016-01-21 16:38:07.752 INFO 23716 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 108 2016-01-21 16:38:07.755 INFO 23716 --- [ main] com.tinguish.mueas.Application : Started Application in 21.824 seconds (JVM running for 23.128) 109 [2016-01-21 16:38:09.971] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpProtocol:169: Warm up done 110 [2016-01-21 16:38:09.988] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- Controller:91: Total number of users : 5 111 [2016-01-21 16:38:09.997] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- FileDataWriter:90: Initializing 112 [2016-01-21 16:38:10.003] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-5] --- ConsoleDataWriter:90: Initializing 113 [2016-01-21 16:38:10.006] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-5] --- ConsoleDataWriter:92: Initialized 114 [2016-01-21 16:38:10.013] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- FileDataWriter:92: Initialized 115 [2016-01-21 16:38:10.038] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Controller:216: Start user #8390468609261222568-0 116 [2016-01-21 16:38:10.039] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Controller:216: Start user #8390468609261222568-1 117 [2016-01-21 16:38:10.040] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Controller:216: Start user #8390468609261222568-2 118 [2016-01-21 16:38:10.041] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Controller:216: Start user #8390468609261222568-3 119 [2016-01-21 16:38:10.041] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Controller:216: Start user #8390468609261222568-4 120 [2016-01-21 16:38:10.059] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Redirect Login Page, userId=8390468609261222568-0 121 [2016-01-21 16:38:10.087] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Redirect Login Page, userId=8390468609261222568-1 122 [2016-01-21 16:38:10.091] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Redirect Login Page, userId=8390468609261222568-2 123 [2016-01-21 16:38:10.093] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Redirect Login Page, userId=8390468609261222568-3 124 [2016-01-21 16:38:10.099] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Redirect Login Page, userId=8390468609261222568-4 125 126 ================================================================================ 127 2016-01-21 16:38:10 0s elapsed 128 ---- Redirect Login Page ------------------------------------------------------- 129 [ ] 0% 130 waiting: 5 / active: 0 / done:0 131 ---- Requests ------------------------------------------------------------------ 132 > Global (OK=0 KO=0 ) 133 134 ================================================================================ 135 136 2016-01-21 16:38:10.218 INFO 23716 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet ‘dispatcherServlet‘ 137 2016-01-21 16:38:10.218 INFO 23716 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet ‘dispatcherServlet‘: initialization started 138 2016-01-21 16:38:10.262 INFO 23716 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet ‘dispatcherServlet‘: initialization completed in 44 ms 139 [2016-01-21 16:38:10.396] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-4] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-4 140 [2016-01-21 16:38:10.398] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-0 141 [2016-01-21 16:38:10.396] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-5] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-3 142 [2016-01-21 16:38:10.403] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-2 143 [2016-01-21 16:38:10.412] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-1 144 [2016-01-21 16:38:11.142] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Pause:46: Pausing for 10000ms (real=9936ms) 145 [2016-01-21 16:38:11.144] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Pause:46: Pausing for 10000ms (real=9974ms) 146 [2016-01-21 16:38:11.144] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Pause:46: Pausing for 10000ms (real=9949ms) 147 [2016-01-21 16:38:11.145] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Pause:46: Pausing for 10000ms (real=9949ms) 148 [2016-01-21 16:38:11.146] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Pause:46: Pausing for 10000ms (real=9945ms) 149 150 ================================================================================ 151 2016-01-21 16:38:15 5s elapsed 152 ---- Redirect Login Page ------------------------------------------------------- 153 [--------------------------------------------------------------------------] 0% 154 waiting: 0 / active: 5 / done:0 155 ---- Requests ------------------------------------------------------------------ 156 > Global (OK=10 KO=0 ) 157 > Redirect Login (OK=5 KO=0 ) 158 > Redirect Login Redirect 1 (OK=5 KO=0 ) 159 ================================================================================ 160 161 162 ================================================================================ 163 2016-01-21 16:38:20 10s elapsed 164 ---- Redirect Login Page ------------------------------------------------------- 165 [--------------------------------------------------------------------------] 0% 166 waiting: 0 / active: 5 / done:0 167 ---- Requests ------------------------------------------------------------------ 168 > Global (OK=10 KO=0 ) 169 > Redirect Login (OK=5 KO=0 ) 170 > Redirect Login Redirect 1 (OK=5 KO=0 ) 171 ================================================================================ 172 173 [2016-01-21 16:38:21.099] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-1 174 [2016-01-21 16:38:21.108] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-2 175 [2016-01-21 16:38:21.121] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-0 176 [2016-01-21 16:38:21.123] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-3 177 [2016-01-21 16:38:21.135] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-4 178 [2016-01-21 16:38:21.233] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-1 179 [2016-01-21 16:38:21.233] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-2 180 [2016-01-21 16:38:21.239] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-8] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-4 181 [2016-01-21 16:38:21.248] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-3 182 [2016-01-21 16:38:21.266] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Try Login uri=http://localhost:8080/login: scenario=Redirect Login Page, userId=8390468609261222568-0 183 [2016-01-21 16:38:21.274] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-10] --- Pause:46: Pausing for 10000ms (real=9985ms) 184 [2016-01-21 16:38:21.281] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- Pause:46: Pausing for 10000ms (real=9984ms) 185 [2016-01-21 16:38:21.289] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Pause:46: Pausing for 10000ms (real=9974ms) 186 [2016-01-21 16:38:21.290] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Pause:46: Pausing for 10000ms (real=9983ms) 187 [2016-01-21 16:38:21.295] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-6] --- Pause:46: Pausing for 10000ms (real=9971ms) 188 189 ================================================================================ 190 2016-01-21 16:38:25 15s elapsed 191 ---- Redirect Login Page ------------------------------------------------------- 192 [--------------------------------------------------------------------------] 0% 193 waiting: 0 / active: 5 / done:0 194 ---- Requests ------------------------------------------------------------------ 195 > Global (OK=20 KO=0 ) 196 > Redirect Login (OK=5 KO=0 ) 197 > Redirect Login Redirect 1 (OK=5 KO=0 ) 198 > Try Login (OK=5 KO=0 ) 199 > Try Login Redirect 1 (OK=5 KO=0 ) 200 ================================================================================ 201 202 203 ================================================================================ 204 2016-01-21 16:38:30 20s elapsed 205 ---- Redirect Login Page ------------------------------------------------------- 206 [--------------------------------------------------------------------------] 0% 207 waiting: 0 / active: 5 / done:0 208 ---- Requests ------------------------------------------------------------------ 209 > Global (OK=20 KO=0 ) 210 > Redirect Login (OK=5 KO=0 ) 211 > Redirect Login Redirect 1 (OK=5 KO=0 ) 212 > Try Login (OK=5 KO=0 ) 213 > Try Login Redirect 1 (OK=5 KO=0 ) 214 ================================================================================ 215 216 [2016-01-21 16:38:31.288] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- Controller:203: End user #8390468609261222568-2 217 [2016-01-21 16:38:31.288] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- Controller:203: End user #8390468609261222568-1 218 [2016-01-21 16:38:31.289] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- Controller:203: End user #8390468609261222568-3 219 [2016-01-21 16:38:31.295] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-8] --- Controller:203: End user #8390468609261222568-4 220 [2016-01-21 16:38:31.297] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-8] --- Controller:203: End user #8390468609261222568-0 221 222 ================================================================================ 223 2016-01-21 16:38:31 21s elapsed 224 ---- Redirect Login Page ------------------------------------------------------- 225 [##########################################################################]100% 226 waiting: 0 / active: 0 / done:5 227 ---- Requests ------------------------------------------------------------------ 228 > Global (OK=20 KO=0 ) 229 > Redirect Login (OK=5 KO=0 ) 230 > Redirect Login Redirect 1 (OK=5 KO=0 ) 231 > Try Login (OK=5 KO=0 ) 232 > Try Login Redirect 1 (OK=5 KO=0 ) 233 ================================================================================ 234 235 Simulation finished 236 Parsing log file(s)... 237 [2016-01-21 16:38:31.375] log4j - ???? INFO [main] --- FileDataReader:56: Collected List(/root/.jenkins/jobs/mueas-gatling/workspace/target/gatling/results/mueassimulation-1453365489988/simulation.log) from mueassimulation-1453365489988 238 [2016-01-21 16:38:31.385] log4j - ???? INFO [main] --- FileDataReader:73: First pass 239 [2016-01-21 16:38:31.392] log4j - ???? INFO [main] --- FileDataReader:118: First pass done: read 31 lines 240 [2016-01-21 16:38:31.397] log4j - ???? INFO [main] --- FileDataReader:132: Second pass 241 [2016-01-21 16:38:31.429] log4j - ???? INFO [main] --- FileDataReader:157: Second pass: read 31 lines 242 Parsing log file(s) done 243 Generating reports... 244 245 ================================================================================ 246 ---- Global Information -------------------------------------------------------- 247 > request count 20 (OK=20 KO=0 ) 248 > min response time 29 (OK=29 KO=- ) 249 > max response time 718 (OK=718 KO=- ) 250 > mean response time 283 (OK=283 KO=- ) 251 > std deviation 250 (OK=250 KO=- ) 252 > response time 50th percentile 206 (OK=206 KO=- ) 253 > response time 75th percentile 398 (OK=398 KO=- ) 254 > mean requests/sec 0.94 (OK=0.94 KO=- ) 255 ---- Response Time Distribution ------------------------------------------------ 256 > t < 800 ms 20 (100%) 257 > 800 ms < t < 1200 ms 0 ( 0%) 258 > t > 1200 ms 0 ( 0%) 259 > failed 0 ( 0%) 260 ================================================================================ 261 262 Reports generated in 0s. 263 Please open the following file: /root/.jenkins/jobs/mueas-gatling/workspace/target/gatling/results/mueassimulation-1453365489988/index.html 264 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 265 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD SUCCESS 266 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 267 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 44.253 s 268 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-01-21T16:38:31+08:00 269 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 13M/228M 270 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 271 ================= POST STEPS TRACKING END =================== 272 Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information 273 Archiving Gatling reports... 274 Adding report ‘mueassimulation-1453365489988‘ 275 2016-01-21 16:38:41.999 INFO 23716 --- [ Thread-2] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot[email protected]1e76c2be: startup date [Thu Jan 21 16:37:46 CST 2016]; root of context hierarchy 276 Finished: SUCCESS
我执行了两次,没有做任何修改,因为一次测试,gatling的结果图上只有一个点,看不出差别。两次之间,有时间上的差别。。。
关于gatling和jenkins的集成的官方信息,可以参考一下下面的链接:
http://gatling.io/docs/2.1.7/extensions/jenkins_plugin.html
http://gatling.io/docs/2.1.7/extensions/maven_plugin.html?highlight=maven%20plugin
到此完