You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2019/09/23 11:59:34 UTC
[jmeter] branch master updated: Improvements:
This is an automated email from the ASF dual-hosted git repository.
pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new db6e22e Improvements:
db6e22e is described below
commit db6e22e58bafea4557fa33ed9383a85aac748c3b
Author: pmouawad <p....@ubik-ingenierie.com>
AuthorDate: Mon Sep 23 13:59:10 2019 +0200
Improvements:
- Make threads, rampup, duration and loops configurable through
properties.
Fixes:
- Use port if different from standard
---
.../http/gui/action/ParseCurlCommandAction.java | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
index 70bc844..63b1831 100644
--- a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
+++ b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
@@ -197,18 +197,19 @@ public class ParseCurlCommandAction extends AbstractAction implements MenuCreato
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setProperty(TestElement.GUI_CLASS, ThreadGroupGui.class.getName());
threadGroup.setProperty(TestElement.NAME, "Thread Group");
- threadGroup.setNumThreads(10);
- threadGroup.setRampUp(10);
+ threadGroup.setProperty(ThreadGroup.NUM_THREADS,"${__P(threads,10)}");
+ threadGroup.setProperty(ThreadGroup.RAMP_TIME,"${__P(rampup,30)}");
threadGroup.setScheduler(true);
- threadGroup.setDuration(3600);
+ threadGroup.setProperty(ThreadGroup.DURATION,"${__P(duration,3600)}");
threadGroup.setDelay(5);
LoopController loopCtrl = new LoopController();
- loopCtrl.setLoops(-1);
- loopCtrl.setContinueForever(true);
+ loopCtrl.setProperty(LoopController.LOOPS,"${__P(iterations,-1)}");
+ loopCtrl.setContinueForever(false);
threadGroup.setSamplerController(loopCtrl);
TestPlan testPlan = new TestPlan();
testPlan.setProperty(TestElement.NAME, "Test Plan");
testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName());
+ testPlan.setComment("You can run me using: jmeter -Jthreads=<Number of threads> -Jrampup=<rampup in seconds> -Jduration=<duration in seconds> -Jiterations=<Number of iterations, -1 means infinite> -e -o <report output folder>");
HashTree tree = new HashTree();
HashTree testPlanHT = tree.add(testPlan);
HashTree threadGroupHT = testPlanHT.add(threadGroup);
@@ -276,9 +277,13 @@ public class ParseCurlCommandAction extends AbstractAction implements MenuCreato
httpSampler.setProperty(TestElement.COMMENTS,
"Created from cURL on " + LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME));
} // NOSONAR
- httpSampler.setProtocol(new URL(request.getUrl()).getProtocol());
- httpSampler.setPath(new URL(request.getUrl()).getPath());
- httpSampler.setDomain(new URL(request.getUrl()).getHost());
+ URL url = new URL(request.getUrl());
+ httpSampler.setProtocol(url.getProtocol());
+ if (url.getPort() != -1) {
+ httpSampler.setPort(url.getPort());
+ }
+ httpSampler.setPath(url.getPath());
+ httpSampler.setDomain(url.getHost());
httpSampler.setUseKeepAlive(request.isKeepAlive());
httpSampler.setFollowRedirects(true);
httpSampler.setMethod(request.getMethod());