Class DslTestPlan
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
-
- us.abstracta.jmeter.javadsl.core.testelements.TestElementContainer<DslTestPlan,DslTestPlan.TestPlanChild>
-
- us.abstracta.jmeter.javadsl.core.DslTestPlan
-
- All Implemented Interfaces:
DslTestElement
public class DslTestPlan extends TestElementContainer<DslTestPlan,DslTestPlan.TestPlanChild>
Represents a JMeter test plan, with associated thread groups and other children elements.- Since:
- 0.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDslTestPlan.CodeBuilderstatic interfaceDslTestPlan.TestPlanChildTest elements that can be added directly as test plan children in JMeter should implement this interface.
-
Field Summary
Fields Modifier and Type Field Description protected booleanserializeThreadGroupsprotected booleantearDownOnlyAfterMainThreadsDone-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.TestElementContainer
children
-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
guiClass, name
-
-
Constructor Summary
Constructors Constructor Description DslTestPlan(List<DslTestPlan.TestPlanChild> children)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.jmeter.testelement.TestElementbuildTestElement()DslTestPlanchildren(DslTestPlan.TestPlanChild... children)Allows adding additional children elements to a test plan.static DslTestPlanfromJmx(String filePath)Loads a test plan from the given JMX to be able to run it in embedded engine.TestPlanStatsrun()UsesEmbeddedJmeterEngineto run the test plan.TestPlanStatsrunIn(DslJmeterEngine engine)Allows to run the test plan in a given engine.voidsaveAsJmx(String filePath)Saves the given test plan as JMX, which allows it to be loaded in JMeter GUI.DslTestPlansequentialThreadGroups()Specifies to run thread groups one after the other, instead of running them in parallel.DslTestPlansequentialThreadGroups(boolean enable)Specifies to run thread groups one after the other, instead of running them in parallel.voidshowInGui()Shows the test element in it's defined GUI in a popup window.voidshowTimeline()For each thread group shows a graph with a timeline of planned load (threads or rps) to be generated.DslTestPlantearDownOnlyAfterMainThreadsDone()Allows running tear down thread groups only after main thread groups ends cleanly (due to iterations or time limit).DslTestPlantearDownOnlyAfterMainThreadsDone(boolean enabled)Allows running tear down thread groups only after main thread groups ends cleanly (due to iterations or time limit).-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.TestElementContainer
buildTreeUnder
-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
buildConfiguredTestElement, buildTestElementGui, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showTestElementGui
-
-
-
-
Constructor Detail
-
DslTestPlan
public DslTestPlan(List<DslTestPlan.TestPlanChild> children)
-
-
Method Detail
-
sequentialThreadGroups
public DslTestPlan sequentialThreadGroups()
Specifies to run thread groups one after the other, instead of running them in parallel.- Returns:
- this instance for fluent API usage.
- Since:
- 0.40
-
sequentialThreadGroups
public DslTestPlan sequentialThreadGroups(boolean enable)
Specifies to run thread groups one after the other, instead of running them in parallel.Same as
sequentialThreadGroups()but allowing to enable/disable the setting during runtime.- Parameters:
enable- specifies to run thread groups one after the other when set to true, or in parallel when false. By default, is set to false.- Returns:
- the test plan for further configuration or usage.
- Since:
- 0.65
-
tearDownOnlyAfterMainThreadsDone
public DslTestPlan tearDownOnlyAfterMainThreadsDone()
Allows running tear down thread groups only after main thread groups ends cleanly (due to iterations or time limit).By default, JMeter automatically executes tear down thread groups when a test plan stops due to unscheduled event like sample error when stop test is configured in thread group, invocation of `ctx.getEngine().askThreadsToStop()` in jsr223 element, etc. This method allows to disable such behavior not running teardown thread groups in such cases, which might be helpful if teardown thread group has only to run on clean test plan completion.
- Returns:
- the test plan for further configuration or usage.
- Since:
- 0.40
-
tearDownOnlyAfterMainThreadsDone
public DslTestPlan tearDownOnlyAfterMainThreadsDone(boolean enabled)
Allows running tear down thread groups only after main thread groups ends cleanly (due to iterations or time limit).By default, JMeter automatically executes tear down thread groups when a test plan stops due to unscheduled event like sample error when stop test is configured in thread group, invocation of `ctx.getEngine().askThreadsToStop()` in jsr223 element, etc. This method allows to disable such behavior not running teardown thread groups in such cases, which might be helpful if teardown thread group has only to run on clean test plan completion.
- Returns:
- this instance for fluent API usage.
- Since:
- 0.65
-
buildTestElement
protected org.apache.jmeter.testelement.TestElement buildTestElement()
- Specified by:
buildTestElementin classBaseTestElement
-
run
public TestPlanStats run() throws IOException
UsesEmbeddedJmeterEngineto run the test plan.- Returns:
TestPlanStatscontaining all statistics of the test plan execution.- Throws:
IOException- thrown when there is some problem running the plan.
-
runIn
public TestPlanStats runIn(DslJmeterEngine engine) throws IOException, InterruptedException, TimeoutException
Allows to run the test plan in a given engine.This method is just a simple method which provides fluent API to run the test plans in a given engine.
- Throws:
IOExceptionInterruptedExceptionTimeoutException- See Also:
DslJmeterEngine.run(DslTestPlan)
-
showInGui
public void showInGui()
Description copied from interface:DslTestElementShows the test element in it's defined GUI in a popup window. This might be handy to visualize the element as it looks in JMeter GUI.- Specified by:
showInGuiin interfaceDslTestElement- Overrides:
showInGuiin classBaseTestElement
-
showTimeline
public void showTimeline()
For each thread group shows a graph with a timeline of planned load (threads or rps) to be generated.Graphs will be displayed in a popup window.
This method eases test plan design when working with complex thread group profiles (several stages with ramps and holds).
- Since:
- 1.28
-
saveAsJmx
public void saveAsJmx(String filePath) throws IOException
Saves the given test plan as JMX, which allows it to be loaded in JMeter GUI.- Parameters:
filePath- specifies where to store the JMX of the test plan.- Throws:
IOException- when there is a problem saving to the file.
-
fromJmx
public static DslTestPlan fromJmx(String filePath) throws IOException
Loads a test plan from the given JMX to be able to run it in embedded engine.- Parameters:
filePath- specifies the path where the JMX file is located.- Returns:
- loaded test plan.
- Throws:
IOException- when there is a problem loading to the file.- Since:
- 0.3
-
children
public DslTestPlan children(DslTestPlan.TestPlanChild... children)
Allows adding additional children elements to a test plan.This might be helpful for adding elements to a test plan loaded from a JMX file (like adding htmlReport, resultsTreeVisualizer or dashboard) or if you want to create a test plan and then incrementally adding children to it.
- Overrides:
childrenin classTestElementContainer<DslTestPlan,DslTestPlan.TestPlanChild>- Parameters:
children- elements to add to the test plan.- Returns:
- the test plan for further usage (run, show, etc).
- Since:
- 0.56
-
-