180 lines
8.5 KiB
Text
180 lines
8.5 KiB
Text
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
|
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
|
||
|
|
<hashTree>
|
||
|
|
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="stitcher-benchmark">
|
||
|
|
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables">
|
||
|
|
<collectionProp name="Arguments.arguments"/>
|
||
|
|
</elementProp>
|
||
|
|
</TestPlan>
|
||
|
|
<hashTree>
|
||
|
|
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group">
|
||
|
|
<stringProp name="ThreadGroup.num_threads">${__P(threads, 10)}</stringProp>
|
||
|
|
<intProp name="ThreadGroup.ramp_time">1</intProp>
|
||
|
|
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
|
||
|
|
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
|
||
|
|
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">
|
||
|
|
<stringProp name="LoopController.loops">${__P(loops, 50)}</stringProp>
|
||
|
|
<boolProp name="LoopController.continue_forever">false</boolProp>
|
||
|
|
</elementProp>
|
||
|
|
</ThreadGroup>
|
||
|
|
<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.protocol">http</stringProp>
|
||
|
|
<stringProp name="HTTPSampler.path">/api/image/generate</stringProp>
|
||
|
|
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
||
|
|
<stringProp name="HTTPSampler.method">POST</stringProp>
|
||
|
|
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||
|
|
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
|
||
|
|
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
|
||
|
|
<collectionProp name="Arguments.arguments">
|
||
|
|
<elementProp name="" elementType="HTTPArgument">
|
||
|
|
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||
|
|
<stringProp name="Argument.value">{
|
||
|
|
"canvas_rect": "${canvasRect}",
|
||
|
|
"crop_offset": [0.25, 0.25],
|
||
|
|
"crop_size": [0.5, 0.5],
|
||
|
|
"output_scale": 0.5
|
||
|
|
}</stringProp>
|
||
|
|
<stringProp name="Argument.metadata">=</stringProp>
|
||
|
|
</elementProp>
|
||
|
|
</collectionProp>
|
||
|
|
</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">
|
||
|
|
<stringProp name="Header.name">Content-Type</stringProp>
|
||
|
|
<stringProp name="Header.value">application/json</stringProp>
|
||
|
|
</elementProp>
|
||
|
|
</collectionProp>
|
||
|
|
</HeaderManager>
|
||
|
|
<hashTree/>
|
||
|
|
</hashTree>
|
||
|
|
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report">
|
||
|
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
||
|
|
<objProp>
|
||
|
|
<name>saveConfig</name>
|
||
|
|
<value class="SampleSaveConfiguration">
|
||
|
|
<time>true</time>
|
||
|
|
<latency>true</latency>
|
||
|
|
<timestamp>true</timestamp>
|
||
|
|
<success>true</success>
|
||
|
|
<label>true</label>
|
||
|
|
<code>true</code>
|
||
|
|
<message>true</message>
|
||
|
|
<threadName>true</threadName>
|
||
|
|
<dataType>true</dataType>
|
||
|
|
<encoding>false</encoding>
|
||
|
|
<assertions>true</assertions>
|
||
|
|
<subresults>true</subresults>
|
||
|
|
<responseData>false</responseData>
|
||
|
|
<samplerData>false</samplerData>
|
||
|
|
<xml>false</xml>
|
||
|
|
<fieldNames>true</fieldNames>
|
||
|
|
<responseHeaders>false</responseHeaders>
|
||
|
|
<requestHeaders>false</requestHeaders>
|
||
|
|
<responseDataOnError>false</responseDataOnError>
|
||
|
|
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
|
||
|
|
<assertionsResultsToSave>0</assertionsResultsToSave>
|
||
|
|
<bytes>true</bytes>
|
||
|
|
<sentBytes>true</sentBytes>
|
||
|
|
<url>true</url>
|
||
|
|
<threadCounts>true</threadCounts>
|
||
|
|
<idleTime>true</idleTime>
|
||
|
|
<connectTime>true</connectTime>
|
||
|
|
</value>
|
||
|
|
</objProp>
|
||
|
|
<stringProp name="filename">/home/ibnufadhil/Documents/projects/benchmark/result.csv</stringProp>
|
||
|
|
</ResultCollector>
|
||
|
|
<hashTree/>
|
||
|
|
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree">
|
||
|
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
||
|
|
<objProp>
|
||
|
|
<name>saveConfig</name>
|
||
|
|
<value class="SampleSaveConfiguration">
|
||
|
|
<time>true</time>
|
||
|
|
<latency>true</latency>
|
||
|
|
<timestamp>true</timestamp>
|
||
|
|
<success>true</success>
|
||
|
|
<label>true</label>
|
||
|
|
<code>true</code>
|
||
|
|
<message>true</message>
|
||
|
|
<threadName>true</threadName>
|
||
|
|
<dataType>true</dataType>
|
||
|
|
<encoding>false</encoding>
|
||
|
|
<assertions>true</assertions>
|
||
|
|
<subresults>true</subresults>
|
||
|
|
<responseData>false</responseData>
|
||
|
|
<samplerData>false</samplerData>
|
||
|
|
<xml>false</xml>
|
||
|
|
<fieldNames>true</fieldNames>
|
||
|
|
<responseHeaders>false</responseHeaders>
|
||
|
|
<requestHeaders>false</requestHeaders>
|
||
|
|
<responseDataOnError>false</responseDataOnError>
|
||
|
|
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
|
||
|
|
<assertionsResultsToSave>0</assertionsResultsToSave>
|
||
|
|
<bytes>true</bytes>
|
||
|
|
<sentBytes>true</sentBytes>
|
||
|
|
<url>true</url>
|
||
|
|
<threadCounts>true</threadCounts>
|
||
|
|
<idleTime>true</idleTime>
|
||
|
|
<connectTime>true</connectTime>
|
||
|
|
</value>
|
||
|
|
</objProp>
|
||
|
|
<stringProp name="filename"></stringProp>
|
||
|
|
</ResultCollector>
|
||
|
|
<hashTree/>
|
||
|
|
</hashTree>
|
||
|
|
</hashTree>
|
||
|
|
</hashTree>
|
||
|
|
</jmeterTestPlan>
|