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/zh-tw/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

發表回復

登錄後才能評論