jmeter 在 ubuntu 上执行 ftp 协议脚本时总是报错。用 ubuntu (apt-get update 后安装的 apt install
jmeter 在 ubuntu 上执行 ftp 协议脚本时总是报错
用 ubuntu 上 apt-get update 后安装的 apt install jmeter, 版本时 Version 2.13.20170723。执行 基于 ftp 协议的脚本时报错空指针
用上传的 5.1.1 的 jmeter 包,虽然不退出,但是很快就 tyding up, 然后退出,其实也是问题。
最后 stackoverflow 上看到,需要安装一个包来支持 jmeter 的 ftp 协议脚本
apt install jmeter-ftp
完美解决。
----------------------------- ftp 协议脚本 : ftp_upload_request_noGui.jmx --------
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.1.1 r1855137">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="ftp_upload_request" 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>
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV_img" enabled="true">
<stringProp name="delimiter">,</stringProp>
<stringProp name="fileEncoding">UTF-8</stringProp>
<stringProp name="filename">./csv/f01/names.txt</stringProp>
<boolProp name="ignoreFirstLine">false</boolProp>
<boolProp name="quotedData">false</boolProp>
<boolProp name="recycle">true</boolProp>
<stringProp name="shareMode">shareMode.all</stringProp>
<boolProp name="stopThread">false</boolProp>
<stringProp name="variableNames">imgUrl</stringProp>
</CSVDataSet>
<hashTree/>
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV_device" enabled="true">
<stringProp name="filename">./csv/devices.txt</stringProp>
<stringProp name="fileEncoding">UTF-8</stringProp>
<stringProp name="variableNames">device</stringProp>
<boolProp name="ignoreFirstLine">false</boolProp>
<stringProp name="delimiter">,</stringProp>
<boolProp name="quotedData">false</boolProp>
<boolProp name="recycle">true</boolProp>
<boolProp name="stopThread">false</boolProp>
<stringProp name="shareMode">shareMode.all</stringProp>
</CSVDataSet>
<hashTree/>
<ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="Constant Throughput Timer" enabled="true">
<intProp name="calcMode">1</intProp>
<doubleProp>
<name>throughput</name>
<value>3000.0</value>
<savedValue>0.0</savedValue>
</doubleProp>
</ConstantThroughputTimer>
<hashTree/>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="ftp_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>
<intProp name="LoopController.loops">-1</intProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">40</stringProp>
<stringProp name="ThreadGroup.ramp_time">3</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<FTPSampler guiclass="FtpTestSamplerGui" testclass="FTPSampler" testname="FTP Request" enabled="true">
<stringProp name="FTPSampler.server">127.0.0.1</stringProp>
<stringProp name="FTPSampler.port">2121</stringProp>
<stringProp name="FTPSampler.filename">smokedevice1/${imgUrl}</stringProp>
<stringProp name="FTPSampler.localfilename">./csv/f01/${imgUrl}</stringProp>
<stringProp name="FTPSampler.inputdata"></stringProp>
<boolProp name="FTPSampler.binarymode">true</boolProp>
<boolProp name="FTPSampler.saveresponse">false</boolProp>
<boolProp name="FTPSampler.upload">true</boolProp>
<stringProp name="ConfigTestElement.username">deepglint</stringProp>
<stringProp name="ConfigTestElement.password">deepglint</stringProp>
</FTPSampler>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
jmeter 3.0版本以上就提供了图形化的html报告了,运行完成之后,执行命令:
jmeter -g test.jtl -o resultreport 生成html报告
参数:
-g : result.jtl 已经存在的.jtl文件的路径。
-o :用于存放html报告的目录
然后resultreport 就是生成的报告文件夹,下载下来查看分析吧;
浙公网安备 33010602011771号