N
Size: a a a
N
ВС
N
ВС
import java.io.File
import io.gatling.core.Predef._
object UtilsFeed {
def getListOfFilesFeeder(dir: String) = {
val file = new File(dir)
Array(
file.listFiles.filter(_.isFile)
.map(("file" -> _.getPath) ) toMap
).queue
}
}
ВС
И
AS
И
VS
VS
И
@Test
public void jmeter() throws IOException {
File jmeterHome = new File("/Downloads/apache-jmeter-5.2.1");
File jmeterProperties = new File(jmeterHome.getPath() + "/bin/jmeter.properties");
JMeterUtils.setJMeterHome(jmeterHome.getPath());
JMeterUtils.loadJMeterProperties(jmeterProperties.getPath());
JMeterUtils.setLocale(Locale.ENGLISH);
StandardJMeterEngine jm = new StandardJMeterEngine();
TestPlan testPlan = new TestPlan("/all/lis");
testPlan.setProperty(TestElement.TEST_CLASS, TestPlan.class.getName());
testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName());
testPlan.setUserDefinedVariables((Arguments) new ArgumentsPanel().createTestElement());
HashTree testPlanTree = new HashTree();
testPlanTree.add(testPlan);
List<String> tokens = getTokens(1);
int number = 1;
for (String token : tokens) {
LoopController loopController = new LoopController();
loopController.setLoops(1);
loopController.setFirst(true);
loopController.setProperty(TestElement.TEST_CLASS, LoopController.class.getName());
loopController.setProperty(TestElement.GUI_CLASS, LoopControlPanel.class.getName());
loopController.initialize();
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setName("User " + number++);
threadGroup.setNumThreads(5);
threadGroup.setRampUp(10);
threadGroup.setSamplerController(loopController);
threadGroup.setProperty(TestElement.TEST_CLASS, ThreadGroup.class.getName());
threadGroup.setProperty(TestElement.GUI_CLASS, ThreadGroupGui.class.getName());
HTTPSamplerProxy httpSampler = new HTTPSamplerProxy();
httpSampler.setProtocol("https");
httpSampler.setDomain("`DOMAIN");
httpSampler.setPath("staff/update");
httpSampler.setMethod("POST");
httpSampler.setName("3");
httpSampler.addNonEncodedArgument("", "JSON\",\"update_fields\": [\"photo_base64\"]}}", "");
httpSampler.setPostBodyRaw(true);
httpSampler.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName());
httpSampler.setProperty(TestElement.GUI_CLASS, HttpTestSampleGui.class.getName());
HeaderManager headerManager = new HeaderManager();
headerManager.setName("Header Manager");
headerManager.add(new Header("accept", "application/json"));
headerManager.add(new Header("x-token", token));
Arguments arg = new Arguments();
arg.addArgument("data", "true");
headerManager.setProperty(TestElement.TEST_CLASS, HeaderManager.class.getName());
headerManager.setProperty(TestElement.GUI_CLASS, HeaderPanel.class.getName());
HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);
threadGroupHashTree.add(headerManager);
threadGroupHashTree.add(otherOperations.changePhoto());
threadGroupHashTree.add(otherOperations.allList());
threadGroupHashTree.add(httpSampler);
System.out.println(threadGroupHashTree);
}
SaveService.saveTree(testPlanTree, new FileOutputStream(" Test plan2.jmx"));
VS
@Test
public void jmeter() throws IOException {
File jmeterHome = new File("/Downloads/apache-jmeter-5.2.1");
File jmeterProperties = new File(jmeterHome.getPath() + "/bin/jmeter.properties");
JMeterUtils.setJMeterHome(jmeterHome.getPath());
JMeterUtils.loadJMeterProperties(jmeterProperties.getPath());
JMeterUtils.setLocale(Locale.ENGLISH);
StandardJMeterEngine jm = new StandardJMeterEngine();
TestPlan testPlan = new TestPlan("/all/lis");
testPlan.setProperty(TestElement.TEST_CLASS, TestPlan.class.getName());
testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName());
testPlan.setUserDefinedVariables((Arguments) new ArgumentsPanel().createTestElement());
HashTree testPlanTree = new HashTree();
testPlanTree.add(testPlan);
List<String> tokens = getTokens(1);
int number = 1;
for (String token : tokens) {
LoopController loopController = new LoopController();
loopController.setLoops(1);
loopController.setFirst(true);
loopController.setProperty(TestElement.TEST_CLASS, LoopController.class.getName());
loopController.setProperty(TestElement.GUI_CLASS, LoopControlPanel.class.getName());
loopController.initialize();
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setName("User " + number++);
threadGroup.setNumThreads(5);
threadGroup.setRampUp(10);
threadGroup.setSamplerController(loopController);
threadGroup.setProperty(TestElement.TEST_CLASS, ThreadGroup.class.getName());
threadGroup.setProperty(TestElement.GUI_CLASS, ThreadGroupGui.class.getName());
HTTPSamplerProxy httpSampler = new HTTPSamplerProxy();
httpSampler.setProtocol("https");
httpSampler.setDomain("`DOMAIN");
httpSampler.setPath("staff/update");
httpSampler.setMethod("POST");
httpSampler.setName("3");
httpSampler.addNonEncodedArgument("", "JSON\",\"update_fields\": [\"photo_base64\"]}}", "");
httpSampler.setPostBodyRaw(true);
httpSampler.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName());
httpSampler.setProperty(TestElement.GUI_CLASS, HttpTestSampleGui.class.getName());
HeaderManager headerManager = new HeaderManager();
headerManager.setName("Header Manager");
headerManager.add(new Header("accept", "application/json"));
headerManager.add(new Header("x-token", token));
Arguments arg = new Arguments();
arg.addArgument("data", "true");
headerManager.setProperty(TestElement.TEST_CLASS, HeaderManager.class.getName());
headerManager.setProperty(TestElement.GUI_CLASS, HeaderPanel.class.getName());
HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);
threadGroupHashTree.add(headerManager);
threadGroupHashTree.add(otherOperations.changePhoto());
threadGroupHashTree.add(otherOperations.allList());
threadGroupHashTree.add(httpSampler);
System.out.println(threadGroupHashTree);
}
SaveService.saveTree(testPlanTree, new FileOutputStream(" Test plan2.jmx"));
И
VS
И
И
VS
VS
VS
И