update throughput tester
This commit is contained in:
parent
4867096047
commit
e3e0c9c21a
3 changed files with 1035 additions and 57 deletions
|
|
@ -5,6 +5,8 @@
|
|||
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables">
|
||||
<collectionProp name="Arguments.arguments"/>
|
||||
</elementProp>
|
||||
<boolProp name="TestPlan.functional_mode">false</boolProp>
|
||||
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
|
||||
</TestPlan>
|
||||
<hashTree>
|
||||
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group">
|
||||
|
|
@ -18,9 +20,21 @@
|
|||
</elementProp>
|
||||
</ThreadGroup>
|
||||
<hashTree>
|
||||
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="canvasRect">
|
||||
<stringProp name="delimiter">,</stringProp>
|
||||
<stringProp name="fileEncoding"></stringProp>
|
||||
<stringProp name="filename">canvas_rects.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">canvasRect</stringProp>
|
||||
</CSVDataSet>
|
||||
<hashTree/>
|
||||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request">
|
||||
<stringProp name="HTTPSampler.domain">${__P(url, stitchaton.local)}</stringProp>
|
||||
<stringProp name="HTTPSampler.port">5000</stringProp>
|
||||
<stringProp name="HTTPSampler.port">${__P(port, 5000)}</stringProp>
|
||||
<stringProp name="HTTPSampler.protocol">http</stringProp>
|
||||
<stringProp name="HTTPSampler.path">/api/image/generate</stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
||||
|
|
@ -43,52 +57,6 @@
|
|||
</elementProp>
|
||||
</HTTPSamplerProxy>
|
||||
<hashTree>
|
||||
<JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="JSR223 PreProcessor">
|
||||
<stringProp name="cacheKey">true</stringProp>
|
||||
<stringProp name="filename"></stringProp>
|
||||
<stringProp name="parameters"></stringProp>
|
||||
<stringProp name="script">// Function to convert a numeric index (1-31) to the SBS Plate Row format (A-AE)
|
||||
String indexToRow(int num) {
|
||||
if (num <= 0) return "";
|
||||
if (num <= 26) {
|
||||
// A-Z is ASCII 65-90. 'A' is char 65. So (num - 1) + 65.
|
||||
return (char)(num + 64) as String;
|
||||
} else {
|
||||
// For AA-AE, the first char is 'A'.
|
||||
// 27 -> AA, 28 -> AB, etc.
|
||||
// The second char is (num - 27) + 65 -> 'A', 'B', etc.
|
||||
return "A" + (char)(num - 26 + 64) as String;
|
||||
}
|
||||
}
|
||||
|
||||
// Define the maximum starting indices for a 2x2 grid
|
||||
// Max row is AE (31), so max starting row is AD (30)
|
||||
// Max col is 55, so max starting col is 54
|
||||
int maxStartRowIndex = 30;
|
||||
int maxStartCol = 54;
|
||||
|
||||
// Generate random starting coordinates
|
||||
// nextInt(bound) generates 0 to bound-1, so add 1
|
||||
int randomRowStartIndex = new Random().nextInt(maxStartRowIndex) + 1;
|
||||
int randomColStart = new Random().nextInt(maxStartCol) + 1;
|
||||
|
||||
// Calculate the end coordinates for the 2x2 grid
|
||||
String rowStart = indexToRow(randomRowStartIndex);
|
||||
String rowEnd = indexToRow(randomRowStartIndex + 1);
|
||||
int colEnd = randomColStart + 1;
|
||||
|
||||
// Construct the final canvas_rect string
|
||||
String canvasRectValue = "${rowStart}${randomColStart}:${rowEnd}${colEnd}";
|
||||
|
||||
// Store the generated string in a JMeter variable named "canvasRect"
|
||||
// This makes it available to the HTTP Request sampler
|
||||
vars.put("canvasRect", canvasRectValue);
|
||||
|
||||
// Optional: Log the generated value to see it in the JMeter log (for debugging)
|
||||
log.info("Generated canvas_rect: " + canvasRectValue);</stringProp>
|
||||
<stringProp name="scriptLanguage">groovy</stringProp>
|
||||
</JSR223PreProcessor>
|
||||
<hashTree/>
|
||||
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager">
|
||||
<collectionProp name="HeaderManager.headers">
|
||||
<elementProp name="" elementType="Header">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue