Class EmbeddedJmeterEngine
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.engines.EmbeddedJmeterEngine
-
- All Implemented Interfaces:
DslJmeterEngine
- Direct Known Subclasses:
DistributedJmeterEngine
public class EmbeddedJmeterEngine extends Object implements DslJmeterEngine
Allows running test plans in an embedded JMeter instance.- Since:
- 0.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEmbeddedJmeterEngine.EmbeddedJMeterEngineStopperstatic classEmbeddedJmeterEngine.TestRunner
-
Constructor Summary
Constructors Constructor Description EmbeddedJmeterEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddStatsCollector(org.apache.jorphan.collections.HashTree testPlanTree, TestPlanStats stats)voidawaitAllClosedVisualizers(List<Future<Void>> closedVisualizers)protected EmbeddedJmeterEngine.TestRunnerbuildTestRunner(org.apache.jorphan.collections.HashTree testPlanTree, org.apache.jorphan.collections.HashTree rootTree, TestStopper testStopper)protected BaseTestStopperbuildTestStopper()EmbeddedJmeterEngineprop(String name, Object value)Allows setting properties to be used during test plan execution.EmbeddedJmeterEnginepropertiesFile(String propsFile)Allows specifying a properties file path to get properties from.TestPlanStatsrun(DslTestPlan testPlan)Runs the given test plan obtaining the execution metrics.protected TestPlanStatsrunInEnv(DslTestPlan testPlan, JmeterEnvironment env)
-
-
-
Method Detail
-
prop
public EmbeddedJmeterEngine prop(String name, Object value)
Allows setting properties to be used during test plan execution.This is an alternate to using
System.setProperty(String, String)but that also works withprops['PROP_NAME']
andprops.get('PROP_NAME')in groovy code, in addition to allowing to set arbitrary objects (and not just strings). This properties additionally don't alter the JVM properties, which is preferable to improve tests isolation.Setting arbitrary objects might be helpful to pass some object that can be reused by all threads in test plan (eg: a cache).
- Parameters:
name- specifies the name of the property, used by test plan to access the associated value.value- specifies a value to store associated to the name.- Returns:
- the engine instance for further configuration or usage.
- Since:
- 0.37
-
propertiesFile
public EmbeddedJmeterEngine propertiesFile(String propsFile)
Allows specifying a properties file path to get properties from.This is handy when different properties are required for different runs (eg: different environments).
This is an alternative to
prop(String, Object)which is handy for setting a small set of properties, or set them programmatically.- Parameters:
propsFile- is the path to the properties file to load.- Returns:
- the engine instance for further configuration or usage.
- Since:
- 0.57
-
run
public TestPlanStats run(DslTestPlan testPlan) throws IOException
Description copied from interface:DslJmeterEngineRuns the given test plan obtaining the execution metrics.This method blocks execution until the test plan execution ends.
- Specified by:
runin interfaceDslJmeterEngine- Parameters:
testPlan- to run in the JMeter engine.- Returns:
- the metrics associated to the run.
- Throws:
IOException- when there is a problem with an IO operation.
-
runInEnv
protected TestPlanStats runInEnv(DslTestPlan testPlan, JmeterEnvironment env) throws IOException
- Throws:
IOException
-
buildTestStopper
protected BaseTestStopper buildTestStopper()
-
addStatsCollector
protected void addStatsCollector(org.apache.jorphan.collections.HashTree testPlanTree, TestPlanStats stats)
-
buildTestRunner
protected EmbeddedJmeterEngine.TestRunner buildTestRunner(org.apache.jorphan.collections.HashTree testPlanTree, org.apache.jorphan.collections.HashTree rootTree, TestStopper testStopper)
-
-