Sameuseroneachiteration的详细阐述

一、同一个用户的作用

Sameuseroneachiteration是JMeter中非常重要的一个元素,可以用于控制多线程模拟下同一个用户在每个迭代中执行任务的行为。同一个用户可以实现用户状态的保持,使得测试结果更加真实。以下是代码示例:

<ThreadGroup>
<elementProp name="ThreadGroup.main_controller">
<TestFragment guiclass="TestFragmentGui" testclass="TestFragment" testname="Test Fragment" enabled="true">
<elementProp name="TestPlan.comments" elementType="Comment" guiclass="CommentGui" testclass="Comment" testname="Comment">
<stringProp name="TestPlan.comments"></stringProp>
</elementProp>
<elementProp name="ThreadGroup.main_controller">
<LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<elementProp name="LoopController.continue_forever" elementType="bool" guiclass="BooleanPropertyEditor" testclass="BooleanProperty" testname="Continue Forever">
<boolProp name="LoopController.continue_forever">false</boolProp>
</elementProp>
<elementProp name="LoopController.loops" elementType="int" guiclass="SpinnerNumber" testclass="LoopController" testname="Loop Controller">
<intProp name="LoopController.loops">1</intProp>
</elementProp>
</LoopController>
</elementProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="myVar" elementType="Argument" guiclass="ArgumentsPanel" testclass="Argument" testname="User Defined Variables" enabled="true">
<stringProp name="Argument.name">myVar</stringProp>
<stringProp name="Argument.value">value</stringProp>
<stringProp name="Argument.metadata"></stringProp>
</elementProp>
</collectionProp>
</elementProp>
<kg.apc.jmeter.threads.UltimateThreadGroup guiclass="kg.apc.jmeter.threads.UltimateThreadGroupGui" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="Ultimate Thread Group" enabled="true">
<collectionProp name="kg.apc.jmeter.threads.UltimateThreadGroup>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.on_sample_error" elementType="string" guiclass="ComboBoxPanel" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="on_sample_error" enabled="true">
</elementProp>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.num_threads" elementType="string" guiclass="kg.apc.jmeter.threads.UltimateThreadGroupNumericEditor" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="num_threads">
<stringProp name="kg.apc.jmeter.threads.UltimateThreadGroup.num_threads">10</stringProp>
</elementProp>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.ramp_up" elementType="string" guiclass="kg.apc.jmeter.threads.UltimateThreadGroupNumericEditor" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="ramp_up">
<stringProp name="kg.apc.jmeter.threads.UltimateThreadGroup.ramp_up">10</stringProp>
</elementProp>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.duration" elementType="string" guiclass="kg.apc.jmeter.threads.UltimateThreadGroupNumericEditor" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="duration">
<stringProp name="kg.apc.jmeter.threads.UltimateThreadGroup.duration">60</stringProp>
</elementProp>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.delay" elementType="string" guiclass="kg.apc.jmeter.threads.UltimateThreadGroupNumericEditor" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="delay">
<stringProp name="kg.apc.jmeter.threads.UltimateThreadGroup.delay">0</stringProp>
</elementProp>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.scheduler" elementType="string" guiclass="kg.apc.jmeter.threads.UltimateThreadGroupComboBox" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="scheduler">
<stringProp name="kg.apc.jmeter.threads.UltimateThreadGroup.scheduler">false</stringProp>
</elementProp>
<elementProp name="kg.apc.jmeter.threads.UltimateThreadGroup.duration_time" elementType="string" guiclass="kg.apc.jmeter.threads.UltimateThreadGroupDurationEditor" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="duration_time">
<stringProp name="kg.apc.jmeter.threads.UltimateThreadGroup.duration_time">300</stringProp>
</elementProp>
</collectionProp>
</kg.apc.jmeter.threads.UltimateThreadGroup>
</TestFragment>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.on_sample_error">stopthread</stringProp>
<elementProp name="ThreadGroup.num_threads" elementType="int" guiclass="SpinnerNumber" testclass="ThreadGroup" testname="Number of Threads (users)">
<intProp name="ThreadGroup.num_threads">10</intProp>
</elementProp>
<elementProp name="ThreadGroup.ramp_time" elementType="int" guiclass="SpinnerNumber" testclass="ThreadGroup" testname="Ramp-Up Period (in seconds)">
<intProp name="ThreadGroup.ramp_time">10</intProp>
</elementProp>
<longProp name="ThreadGroup.start_time">1629049480000</longProp>
<longProp name="ThreadGroup.end_time">1629049480000</longProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
</elementProp>
<HashTree>
<TestFragment guiclass="TestFragmentGui" testclass="TestFragment" testname="Test Fragment" enabled="true">
<elementProp name="TestPlan.comments" elementType="Comment" guiclass="CommentGui" testclass="Comment" testname="Comment">
<stringProp name="TestPlan.comments"></stringProp>
</elementProp>
<GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="检查用户登录" enabled="true"/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="请求数据" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="data" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">${__V(myVar)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">localhost</stringProp>
<stringProp name="HTTPSampler.port">8080</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/test</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<elementProp name="HTTPSampler.use_keepalive" elementType="bool" guiclass="BooleanPropertyEditor" testclass="BooleanProperty" testname="Use KeepAlive">
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</elementProp>
<elementProp name="HTTPSampler.auto_redirects" elementType="bool" guiclass="BooleanPropertyEditor" testclass="BooleanProperty" testname="Follow Redirects">
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
</elementProp>
<elementProp name="HTTPSampler.use_multipart_for_http_post" elementType="bool" guiclass="BooleanPropertyEditor" testclass="BooleanProperty" testname="Use multipart/form-data for HTTP POST";>
<boolProp name="HTTPSampler.use_multipart_for_http_post">false</boolProp>
</elementProp>
<elementProp name="HTTPSampler.DO_MULTIPART_POST" elementType="bool" guiclass="BooleanPropertyEditor" testclass="BooleanProperty" testname="Send File With Request";>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</elementProp>
<elementProp name="HTTPSampler.monitor" elementType="MonitorData" guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy">
<boolProp name=&

原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/301504.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
小蓝小蓝
上一篇 2024-12-30 16:09
下一篇 2024-12-30 16:09

相关推荐

  • index.html怎么打开 – 详细解析

    一、index.html怎么打开看 1、如果你已经拥有了index.html文件,那么你可以直接使用任何一个现代浏览器打开index.html文件,比如Google Chrome、…

    编程 2025-04-25
  • Resetful API的详细阐述

    一、Resetful API简介 Resetful(REpresentational State Transfer)是一种基于HTTP协议的Web API设计风格,它是一种轻量级的…

    编程 2025-04-25
  • 关键路径的详细阐述

    关键路径是项目管理中非常重要的一个概念,它通常指的是项目中最长的一条路径,它决定了整个项目的完成时间。在这篇文章中,我们将从多个方面对关键路径做详细的阐述。 一、概念 关键路径是指…

    编程 2025-04-25
  • AXI DMA的详细阐述

    一、AXI DMA概述 AXI DMA是指Advanced eXtensible Interface Direct Memory Access,是Xilinx公司提供的基于AMBA…

    编程 2025-04-25
  • neo4j菜鸟教程详细阐述

    一、neo4j介绍 neo4j是一种图形数据库,以实现高效的图操作为设计目标。neo4j使用图形模型来存储数据,数据的表述方式类似于实际世界中的网络。neo4j具有高效的读和写操作…

    编程 2025-04-25
  • c++ explicit的详细阐述

    一、explicit的作用 在C++中,explicit关键字可以在构造函数声明前加上,防止编译器进行自动类型转换,强制要求调用者必须强制类型转换才能调用该函数,避免了将一个参数类…

    编程 2025-04-25
  • HTMLButton属性及其详细阐述

    一、button属性介绍 button属性是HTML5新增的属性,表示指定文本框拥有可供点击的按钮。该属性包括以下几个取值: 按钮文本 提交 重置 其中,type属性表示按钮类型,…

    编程 2025-04-25
  • Vim使用教程详细指南

    一、Vim使用教程 Vim是一个高度可定制的文本编辑器,可以在Linux,Mac和Windows等不同的平台上运行。它具有快速移动,复制,粘贴,查找和替换等强大功能,尤其在面对大型…

    编程 2025-04-25
  • crontab测试的详细阐述

    一、crontab的概念 1、crontab是什么:crontab是linux操作系统中实现定时任务的程序,它能够定时执行与系统预设时间相符的指定任务。 2、crontab的使用场…

    编程 2025-04-25
  • 网站测试工具的详细阐述

    一、测试工具的概述 在软件开发的过程中,测试工具是一个非常重要的环节。测试工具可以快速、有效地检测软件中的缺陷,提高软件的质量和稳定性。与此同时,测试工具还可以提高软件开发的效率,…

    编程 2025-04-25

发表回复

登录后才能评论