Jmeter高阶学习,运用NotePad++编写工程,随意复制多个工程到同一个工程
Jmeter创建了工程之后,保存文件后就是一个jmx后缀的文件,你有没有试过单独用文本编辑器打开文件,编辑文件?
Step1: 最简单的Jmeter工程,只有一个测试计划
<?xml version="1.0" encoding="UTF-8"?> <jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" 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/> </hashTree> </jmeterTestPlan>
Step2: 了解hasetree层级关系
<?xml version="1.0" encoding="UTF-8"?> <jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" 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="1111111111111" 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">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree/> </hashTree> </hashTree> </jmeterTestPlan>
仔细观察发现多了ThreadGroup 以及两个想对应的hashtree,因为线程组是在测试计划之下的,所以属于下一级。
感觉就这么简单,可以随意打开各个jmx工程相互拼接了 哈哈哈哈哈^_^
同一级并列关系的两个元素用<hashtree/>
下一级有包含关系的两个元素用<hashtree></hashtree>
快去愉快的copy2paste吧
------------------------- A little Progress a day makes you a big success... ----------------------------