本文整理汇总了Java中org.apache.jmeter.reporters.Summariser类的典型用法代码示例。如果您正苦于以下问题:Java Summariser类的具体用法?Java Summariser怎么用?Java Summariser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Summariser类属于org.apache.jmeter.reporters包,在下文中一共展示了Summariser类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extractTotals
import org.apache.jmeter.reporters.Summariser; //导入依赖的package包/类
private Map<String, String> extractTotals(Summariser summer) {
Map<String, String> values = new HashMap<>();
try {
Field gross = Summariser.class.getDeclaredField("myTotals");
gross.setAccessible(true);
Object obj = gross.get(summer);
Field total = obj.getClass().getDeclaredField("total");
total.setAccessible(true);
Object totalObj = total.get(obj);
Method[] methods = totalObj.getClass().getDeclaredMethods();
for(Method method : methods) {
if (method.getName().startsWith("get")){
method.setAccessible(true);
values.put(method.getName().replace("get", ""),
method.invoke(totalObj).toString());
}
}
} catch (NoSuchFieldException | IllegalAccessException | InvocationTargetException ex) {
ex.printStackTrace(System.out);
}
return values;
}
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:23,代码来源:ConverterLoadTest.java
示例2: executePlan
import org.apache.jmeter.reporters.Summariser; //导入依赖的package包/类
private Map<String, String> executePlan(int numLoops, int numThreads, int rampUp) throws IOException {
HashTree testPlanTree = new HashTree();
HTTPSamplerProxy httpSampler = makeSampler();
LoopController loopController = new LoopController();
loopController.setLoops(numLoops);
loopController.addTestElement(httpSampler);
loopController.setFirst(true);
loopController.initialize();
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setNumThreads(numThreads);
threadGroup.setRampUp(rampUp);
threadGroup.setSamplerController(loopController);
TestPlan testPlan = new TestPlan("JMeter regression test");
HashTree tpConfig = testPlanTree.add(testPlan);
HashTree tgConfig = tpConfig.add(threadGroup);
tgConfig.add(httpSampler);
Summariser summer = new Summariser("summary");
ResultCollector logger = new ResultCollector(summer);
tgConfig.add(logger);
jmeter.configure(testPlanTree);
jmeter.run();
return extractTotals(summer);
}
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:30,代码来源:ConverterLoadTest.java
示例3: ResultCollector
import org.apache.jmeter.reporters.Summariser; //导入依赖的package包/类
/**
* Constructor which sets the used {@link Summariser}
*
* @param summer
* The {@link Summariser} to use
*/
public ResultCollector(Summariser summer) {
setErrorLogging(false);
setSuccessOnlyLogging(false);
setProperty(new ObjectProperty(SAVE_CONFIG, new SampleSaveConfiguration()));
summariser = summer;
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:13,代码来源:ResultCollector.java
示例4: createTestElement
import org.apache.jmeter.reporters.Summariser; //导入依赖的package包/类
/**
* @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
*/
@Override
public TestElement createTestElement() {
Summariser summariser = new Summariser();
modifyTestElement(summariser);
return summariser;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:10,代码来源:SummariserGui.java
示例5: runJMeter
import org.apache.jmeter.reporters.Summariser; //导入依赖的package包/类
protected void runJMeter(String className) throws Exception {
int iterations = Integer.valueOf(getTestConfiguration(className, "iterations", "1"));
int threads = Integer.valueOf(getTestConfiguration(className, "threads", "1"));
log.info("starting test " + StringUtils.substringAfterLast(className, "."));
// loop controller
LoopController loopController = new LoopController();
loopController.setLoops(iterations);
loopController.setFirst(true);
loopController.initialize();
// thread group
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setNumThreads(threads);
threadGroup.setRampUp(1);
threadGroup.setSamplerController(loopController);
// JavaSampler
JavaSampler javaSampler = new JavaSampler();
javaSampler.setClassname(className);
javaSampler.setArguments(arguments);
// summary
Summariser summariser = new Summariser("summary");
ResultCollector logger = new ResultCollector(summariser);
// simple listener to track if at least one test failed
GlobalResult globalResult = new GlobalResult();
// create test plan
TestPlan testPlan = new TestPlan();
// assemble the test plan from previously initialized elements
HashTree testPlanHashTree = new HashTree();
testPlanHashTree.add(testPlan);
HashTree threadGroupHashTree = new HashTree();
threadGroupHashTree = testPlanHashTree.add(testPlan, threadGroup);
HashTree javaSamplerHashTree = new HashTree();
javaSamplerHashTree = threadGroupHashTree.add(javaSampler);
javaSamplerHashTree.add(logger);
javaSamplerHashTree.add(globalResult);
// start JMeter test
StandardJMeterEngine jmeter = new StandardJMeterEngine();
jmeter.configure(testPlanHashTree);
jmeter.run();
// increase log level to display the final summary
LoggingManager.setPriority(Priority.INFO, "jmeter.reporters.Summariser");
logger.testEnded();
LoggingManager.setPriority(Priority.WARN, "jmeter.reporters.Summariser");
// set the JUnit test result
assertTrue(!globalResult.isFailed());
}
开发者ID:savoirfairelinux,项目名称:jmeter-openstack,代码行数:57,代码来源:AbstractOpenstackSamplerTest.java
示例6: main
import org.apache.jmeter.reporters.Summariser; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
JMeterUtils.setJMeterHome("src/test/resources/");
JMeterUtils.loadJMeterProperties("src/test/resources/jmeter.properties");
JMeterUtils.setProperty("saveservice_properties", "saveservice.properties");
JMeterUtils.setProperty("search_paths", "ApacheJMeter_functions-2.9.jar");
JMeterUtils.setLocale(Locale.JAPAN);
JMeterEngine engine = new StandardJMeterEngine();
HashTree config = new ListedHashTree();
TestPlan testPlan = new TestPlan("websocket test");
testPlan.setFunctionalMode(false);
testPlan.setSerialized(false);
testPlan.setProperty(new BooleanProperty(TestElement.ENABLED, true));
testPlan.setUserDefinedVariables(new Arguments());
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setNumThreads(300);
threadGroup.setRampUp(20);
threadGroup.setDelay(0);
threadGroup.setDuration(0);
threadGroup.setProperty(new StringProperty(ThreadGroup.ON_SAMPLE_ERROR, "continue"));
threadGroup.setScheduler(false);
threadGroup.setName("Group1");
threadGroup.setProperty(new BooleanProperty(TestElement.ENABLED, true));
LoopController controller = new LoopController();
controller.setLoops(10);
controller.setContinueForever(false);
controller.setProperty(new BooleanProperty(TestElement.ENABLED, true));
threadGroup.setProperty(new TestElementProperty(ThreadGroup.MAIN_CONTROLLER, controller));
CSVDataSet csvDataSet = new CSVDataSet();
csvDataSet.setProperty(new StringProperty("filename", "src/test/resources/users.csv"));
csvDataSet.setProperty(new StringProperty("variableNames", "USER_NAME"));
csvDataSet.setProperty(new StringProperty("delimiter", ","));
csvDataSet.setProperty(new StringProperty("shareMode", "shareMode.all"));
csvDataSet.setProperty("quoted", false);
csvDataSet.setProperty("recycle", true);
csvDataSet.setProperty("stopThread", false);
WebSocketSampler sampler = new WebSocketSampler();
sampler.setName("WebSocket Test");
sampler.setProperty(new BooleanProperty(TestElement.ENABLED, true));
sampler.addNonEncodedArgument("name", "${USER_NAME}", "=");
sampler.setContentEncoding("UTF-8");
sampler.setProtocol("ws");
sampler.setDomain("localhost");
sampler.setPort(9090);
sampler.setPath("/", "UTF-8");
sampler.setSendMessage("${__RandomString(50,ABCDEFGHIJKLMNOPQRSTUVWXYZ)}");
sampler.setRecvMessage("\"name\":\"${USER_NAME}\"");
OnceOnlyController onceOnlyController = new OnceOnlyController();
Summariser summariser = new Summariser();
HashTree tpConfig = config.add(testPlan);
HashTree tgConfig = tpConfig.add(threadGroup);
HashTree oocConfig = tgConfig.add(onceOnlyController);
oocConfig.add(csvDataSet);
UniformRandomTimer randomTimer = new UniformRandomTimer();
randomTimer.setRange(3000);
HashTree samplerConfig = tgConfig.add(sampler);
samplerConfig.add(summariser);
tgConfig.add(randomTimer);
engine.configure(config);
engine.runTest();
}
开发者ID:kawasima,项目名称:jmeter-websocket,代码行数:71,代码来源:WebSocketSamplerTest.java
注:本文中的org.apache.jmeter.reporters.Summariser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论