上三篇文章中,我们从windows下Web自动化测试工具的安装再到将Web自动化测试工具RobotFramework+Selenium+Chome容器化,最后利用容器化后的自动化工具与Jenkins Docker Cloud集成,并在Pipeline中实现Web的自动化测试。
三篇文章链接见下:
Devops关键工具及技术(六)—基于Pipeline的Web自动化测试(Windows下自动化测试工具安装)
Devops关键工具及技术(六)—基于Pipeline的Web自动化测试(Web自动化测试工具容器化)
Devops关键工具及技术(六)—基于Pipeline的Web自动化测试(Web自动化测试的流水线集成)
有了自动化测试、自然性能测试也需要成为Pipeline的一部分。性能测试的工具常见的主要有Jmeter和LoadRunner。我们将选用Jmeter作为我们的主角。因为它是免费的。由于在Windows下安装Jmeter比较简单,所以我们在Jmeter性能测试会由两种文章来介绍。分别是Jmeter性能测试容器化、Jmeter性能测试的流水线集成。
本篇我们将先介绍Jmeter性能测试的流水线集成
1、性能测试节点
我们将会参考Devops关键工具及技术(一)—Jenkins 容器化和Devops关键工具及技术(六)—基于Pipeline的Web自动化测试(Web自动化测试的流水线集成)的增加Slave和Robot节点方式来将Jmeter性能测试节点加入到Jenkins中,目的为了将Jmeter性能测试成为流水线的一部分。
在此之前我们需要将Jmeter测试进行容器化,具体可以参考Devops关键工具及技术(七)—基于Pipeline的Jmeter性能测试(Jmeter容器化)。
- JenkinsMaster上配置Jmeter性能测试节点的信息
在做配置之前我们也还是需要对该加入进来的节点做一下配置,具体的操作可以从上面提到的两篇文章中获知,这里不做过多讲解。可参考下面的截图



2、Pipeline流水线的集成
基于之前Web自动化测试的流水线,我们加入Jmeter性能测试的Stage。在此之前我们的Pipeline里面加入了Checkout Code、Mvn Build、Sonar、Bash Deploy、RobotFramework等Stage,这次我们在后面加上Jmeter性能测试的Stage。如下:
- 性能测试脚本
脚本可以在这里找到:https://github.com/zbbkeepgoing/springboot-demo/blob/master/jmeter/demo.jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Demo" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">10</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">2</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="index" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">192.168.88.130</stringProp>
<stringProp name="HTTPSampler.port">8080</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stri


6298

被折叠的 条评论
为什么被折叠?



