jenkins:应用篇(Gatling plugin的使用)
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{ 8val httpConf = http.baseURL("http://localhost:8080") 9var scn = scenario("Search mueas home page")10.exec(http("Redirect Login").get("/").check(currentLocation.saveAs("post_url")))11.pause(10 seconds)12.exec(http("Try login").post("${post_url}")13.formParam("useame", "你的用户名")14.formParam("password", “你的密码").check(currentLocation.is("http://localhost:8080/")))15.pause(10 seconds)16setUp(scn.inject(atOnceUsers(2)).protocols(httpConf))17 }
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 git@109.105.5.108:/data/git/mueas.git # timeout=10 6 Fetching upstream changes from git@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 git@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 b9dc8261faf8d172c9ee689048b232b9b7c698d2 (refs/remotes/origin/master) 13 > git config core.sparsecheckout # timeout=10 14 > git checkout -f b9dc8261faf8d172c9ee689048b232b9b7c698d2 15 > git rev-list 7ae96f26da0f7b1ff289b6008d3531872938bd17 # timeout=10 16 > git tag -a -f -m Jenkins Build #15 jenkins-mueas-gatling-15 # timeout=10 17 [workspace] $ /bin/bash /tmp/hudson7254261757720827244.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 48577 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 [470 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.598 s 66 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-01-22T11:51:28+08:00 67 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 34M/381M 68 [pool-1-thread-1 for channel] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ 69 Waiting for Jenkins to finish collecting data 70 [JENKINS] Archiving /root/.jenkins/jobs/mueas-gatling/workspace/pom.xml to com.tinguish/mueas/0.0.1-SNAPSHOT/mueas-0.0.1-SNAPSHOT.pom 71 [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 72 channel stopped 73 [workspace] $ /bin/bash /tmp/hudson1088999714714478379.sh 74 ================= POST STEPS TRACKING BEGIN ================= 75 WORKSPACE: /root/.jenkins/jobs/mueas-gatling/workspace 76 target dir: /root/.jenkins/jobs/mueas-gatling/workspace/target 77 war file: /root/.jenkins/jobs/mueas-gatling/workspace/target/mueas-0.0.1-SNAPSHOT.war 78 BEGIN TO DO GATLING SIMULATION.... 79 SLF4J: Class path contains multiple SLF4J bindings. 80 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] 81 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] 82 SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 83 SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 84 85 .____ ___ _ _ 86 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ 87 ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 88 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 89 ' |____| .__|_| |_|_| |_\__, | / / / / 90 =========|_|==============|___/=/_/_/_/ 91 :: Spring Boot ::(v1.2.7.RELEASE) 92 93 2016-01-22 11:51:31.766 INFO 6660 --- [main] com.tinguish.mueas.Application: Starting Application on CloudGame with PID 6660 94 95 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 96 这里省略了mueas项目启动的日志,和这个博文的重点不相干,且涉及到项目机密 97 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 98 99 2016-01-22 11:51:55.192 INFO 6660 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)100 2016-01-22 11:51:55.194 INFO 6660 --- [main] com.tinguish.mueas.Application: Started Application in 24.398 seconds (JVM running for 25.896)101 Simulation simple.MueasSimulation started...102 [2016-01-22 11:52:00.499] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- HttpProtocol:123: Start warm up103 [2016-01-22 11:52:06.012] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- HttpProtocol:169: Warm up done104 [2016-01-22 11:52:06.030] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- Controller:91: Total number of users : 2105 [2016-01-22 11:52:06.042] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- FileDataWriter:90: Initializing106 [2016-01-22 11:52:06.042] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- ConsoleDataWriter:90: Initializing107 [2016-01-22 11:52:06.052] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- ConsoleDataWriter:92: Initialized108 [2016-01-22 11:52:06.065] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- FileDataWriter:92: Initialized109 [2016-01-22 11:52:06.094] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- Controller:216: Start user #1295396986639070879-0110 [2016-01-22 11:52:06.100] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- Controller:216: Start user #1295396986639070879-1111 [2016-01-22 11:52:06.143] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Search mueas home page, userId=1295396986639070879-0112 [2016-01-22 11:52:06.180] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/: scenario=Search mueas home page, userId=1295396986639070879-1113 114 ================================================================================115 2016-01-22 11:52:060s elapsed116 ---- Search mueas home page ----------------------------------------------------117 [ ] 0%118 waiting: 2 / active: 0 / done:0 119 ---- Requests ------------------------------------------------------------------120 > Global(OK=0 KO=0 )121 122 ================================================================================123 124 2016-01-22 11:52:06.291 INFO 6660 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]: Initializing Spring FrameworkServlet 'dispatcherServlet'125 2016-01-22 11:52:06.291 INFO 6660 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet: FrameworkServlet 'dispatcherServlet': initialization started126 2016-01-22 11:52:06.332 INFO 6660 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet: FrameworkServlet 'dispatcherServlet': initialization completed in 41 ms127 [2016-01-22 11:52:06.450] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Search mueas home page, userId=1295396986639070879-0128 [2016-01-22 11:52:06.451] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Redirect Login uri=http://localhost:8080/login: scenario=Search mueas home page, userId=1295396986639070879-1129 [2016-01-22 11:52:07.057] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- Pause:46: Pausing for 10000ms (real=9970ms)130 [2016-01-22 11:52:07.059] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- Pause:46: Pausing for 10000ms (real=9955ms)131 132 ================================================================================133 2016-01-22 11:52:115s elapsed134 ---- Search mueas home page ----------------------------------------------------135 [--------------------------------------------------------------------------] 0%136 waiting: 0 / active: 2 / done:0 137 ---- Requests ------------------------------------------------------------------138 > Global(OK=4 KO=0 )139 > Redirect Login(OK=2 KO=0 )140 > Redirect Login Redirect 1(OK=2 KO=0 )141 ================================================================================142 143 144 ================================================================================145 2016-01-22 11:52:16 10s elapsed146 ---- Search mueas home page ----------------------------------------------------147 [--------------------------------------------------------------------------] 0%148 waiting: 0 / active: 2 / done:0 149 ---- Requests ------------------------------------------------------------------150 > Global(OK=4 KO=0 )151 > Redirect Login(OK=2 KO=0 )152 > Redirect Login Redirect 1(OK=2 KO=0 )153 ================================================================================154 155 [2016-01-22 11:52:17.035] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try login uri=http://localhost:8080/login: scenario=Search mueas home page, userId=1295396986639070879-1156 [2016-01-22 11:52:17.059] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try login uri=http://localhost:8080/login: scenario=Search mueas home page, userId=1295396986639070879-0157 [2016-01-22 11:52:17.198] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- HttpEngine:270: Sending request=Try login uri=http://localhost:8080/login: scenario=Search mueas home page, userId=1295396986639070879-1158 [2016-01-22 11:52:17.210] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-3] --- HttpEngine:270: Sending request=Try login uri=http://localhost:8080/login: scenario=Search mueas home page, userId=1295396986639070879-0159 [2016-01-22 11:52:17.269] log4j - ???? WARN [GatlingSystem-akka.actor.default-dispatcher-3] --- AsyncHandlerActor:119: Request 'Try login Redirect 1' failed: currentLocation.find.is(http://localhost:8080/), but actually found http://localhost:8080/login160 [2016-01-22 11:52:17.271] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-7] --- Pause:46: Pausing for 10000ms (real=9980ms)161 [2016-01-22 11:52:17.273] log4j - ???? WARN [GatlingSystem-akka.actor.default-dispatcher-2] --- AsyncHandlerActor:119: Request 'Try login Redirect 1' failed: currentLocation.find.is(http://localhost:8080/), but actually found http://localhost:8080/login162 [2016-01-22 11:52:17.274] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-2] --- Pause:46: Pausing for 10000ms (real=9968ms)163 164 ================================================================================165 2016-01-22 11:52:21 15s elapsed166 ---- Search mueas home page ----------------------------------------------------167 [--------------------------------------------------------------------------] 0%168 waiting: 0 / active: 2 / done:0 169 ---- Requests ------------------------------------------------------------------170 > Global(OK=6 KO=2 )171 > Redirect Login(OK=2 KO=0 )172 > Redirect Login Redirect 1(OK=2 KO=0 )173 > Try login(OK=2 KO=0 )174 > Try login Redirect 1 (OK=0 KO=2 )175 ---- Errors --------------------------------------------------------------------176 > currentLocation.find.is(http://localhost:8080/), but actually2 (100.0%)177 found http://localhost:8080/login178 ================================================================================179 180 181 ================================================================================182 2016-01-22 11:52:26 20s elapsed183 ---- Search mueas home page ----------------------------------------------------184 [--------------------------------------------------------------------------] 0%185 waiting: 0 / active: 2 / done:0 186 ---- Requests ------------------------------------------------------------------187 > Global(OK=6 KO=2 )188 > Redirect Login(OK=2 KO=0 )189 > Redirect Login Redirect 1(OK=2 KO=0 )190 > Try login(OK=2 KO=0 )191 > Try login Redirect 1 (OK=0 KO=2 )192 ---- Errors --------------------------------------------------------------------193 > currentLocation.find.is(http://localhost:8080/), but actually2 (100.0%)194 found http://localhost:8080/login195 ================================================================================196 197 [2016-01-22 11:52:27.263] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Controller:203: End user #1295396986639070879-0198 [2016-01-22 11:52:27.265] log4j - ???? INFO [GatlingSystem-akka.actor.default-dispatcher-9] --- Controller:203: End user #1295396986639070879-1199 200 ================================================================================201 2016-01-22 11:52:27 21s elapsed202 ---- Search mueas home page ----------------------------------------------------203 [##########################################################################]100%204 waiting: 0 / active: 0 / done:2 205 ---- Requests ------------------------------------------------------------------206 > Global(OK=6 KO=2 )207 > Redirect Login(OK=2 KO=0 )208 > Redirect Login Redirect 1(OK=2 KO=0 )209 > Try login(OK=2 KO=0 )210 > Try login Redirect 1 (OK=0 KO=2 )211 ---- Errors --------------------------------------------------------------------212 > currentLocation.find.is(http://localhost:8080/), but actually2 (100.0%)213 found http://localhost:8080/login214 ================================================================================215 216 Simulation finished217 Parsing log file(s)...218 [2016-01-22 11:52:27.503] log4j - ???? INFO [main] --- FileDataReader:56: Collected List(/root/.jenkins/jobs/mueas-gatling/workspace/target/gatling/results/mueassimulation-1453434726032/simulation.log) from mueassimulation-1453434726032219 [2016-01-22 11:52:27.509] log4j - ???? INFO [main] --- FileDataReader:73: First pass220 [2016-01-22 11:52:27.514] log4j - ???? INFO [main] --- FileDataReader:118: First pass done: read 13 lines221 [2016-01-22 11:52:27.517] log4j - ???? INFO [main] --- FileDataReader:132: Second pass222 [2016-01-22 11:52:27.544] log4j - ???? INFO [main] --- FileDataReader:157: Second pass: read 13 lines223 Parsing log file(s) done224 Generating reports...225 226 ================================================================================227 ---- Global Information --------------------------------------------------------228 > request count 8 (OK=6 KO=2 )229 > min response time 62 (OK=148KO=62)230 > max response time573 (OK=573KO=68)231 > mean response time258 (OK=322KO=65)232 > std deviation189 (OK=176KO=3 )233 > response time 50th percentile194 (OK=250KO=65)234 > response time 75th percentile339 (OK=485KO=66)235 > mean requests/sec 0.378 (OK=0.283 KO=0.094 )236 ---- Response Time Distribution ------------------------------------------------237 > t < 800 ms 6 ( 75%)238 > 800 ms < t < 1200 ms0 ( 0%)239 > t > 1200 ms0 ( 0%)240 > failed 2 ( 25%)241 ---- Errors --------------------------------------------------------------------242 > currentLocation.find.is(http://localhost:8080/), but actually2 (100.0%)243 found http://localhost:8080/login244 ================================================================================245 246 Reports generated in 0s.247 Please open the following file: /root/.jenkins/jobs/mueas-gatling/workspace/target/gatling/results/mueassimulation-1453434726032/index.html248 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------249 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD SUCCESS250 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------251 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 55.110 s252 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-01-22T11:52:27+08:00253 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 13M/228M254 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------255 ================= POST STEPS TRACKING END ===================256 Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information257 Archiving Gatling reports...258 2016-01-22 11:52:38.063 INFO 6660 --- [Thread-2] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3e795823: startup date [Fri Jan 22 11:51:32 CST 2016]; root of context hierarchy259 2016-01-22 11:52:38.065 INFO 6660 --- [Thread-2] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 2147483647260 Adding report 'mueassimulation-1453434726032'261 Finished: SUCCESS
从上面的log日志中可以发现,gatling的测试结果是一个逻辑正常的测试,虽然check点失败(因为我给的用户名和密码都不对,所以登录失败,不可能进入到项目的主目录,只会停留在login的页面。),但是gatling的测试流程是没有问题的。
我执行了两次,没有做任何修改,因为一次测试,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
到此完
来源链接:https://www.cnblogs.com/shihuc/p/5149035.html
版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。
2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。