Class OctoPerfEngine
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.engines.BaseRemoteEngine<OctoPerfClient,OctoPerfTestPlanStats>
-
- us.abstracta.jmeter.javadsl.octoperf.OctoPerfEngine
-
- All Implemented Interfaces:
us.abstracta.jmeter.javadsl.core.DslJmeterEngine
public class OctoPerfEngine extends BaseRemoteEngine<OctoPerfClient,OctoPerfTestPlanStats>
ADslJmeterEnginewhich allows running DslTestPlan in OctoPerf.- Since:
- 0.58
-
-
Field Summary
-
Fields inherited from class us.abstracta.jmeter.javadsl.engines.BaseRemoteEngine
apiClient
-
-
Constructor Summary
Constructors Constructor Description OctoPerfEngine(String apiKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OctoPerfClientbuildClient()OctoPerfEngineholdFor(Duration holdFor)Specifies the duration of time to keep the virtual users running, after the rampUp period.OctoPerfEngineprojectCleanUp(boolean enabled)Allows enabling or disabling de automatic deletion of virtual users and scenarios from project.OctoPerfEngineprojectName(String projectName)Sets the name of the OctoPerf project to use.OctoPerfEnginerampUpFor(Duration rampUp)Sets the duration of time taken to start the specified total users.OctoPerfTestPlanStatsrun(File jmxFile, org.apache.jorphan.collections.HashTree tree, us.abstracta.jmeter.javadsl.core.BuildTreeContext context)OctoPerfEnginetestTimeout(Duration testTimeout)Specifies a timeout for the entire test execution.OctoPerfEnginetotalUsers(int totalUsers)Specifies the number of virtual users to use when running the test.-
Methods inherited from class us.abstracta.jmeter.javadsl.engines.BaseRemoteEngine
buildTestStopper, buildTree, extractFirstThreadGroup, findDependencies, hasTimedOut, isAutoStoppableTest, prettyDuration, run
-
-
-
-
Constructor Detail
-
OctoPerfEngine
public OctoPerfEngine(String apiKey)
- Parameters:
apiKey- is the authentication token to be used to access OctoPerf API.Check OctoPerf API keys for instructions on how to get it.
-
-
Method Detail
-
projectName
public OctoPerfEngine projectName(String projectName)
Sets the name of the OctoPerf project to use.OctoPerfEngine will search for a project with the given name in the default workspace and if one exists, it will use it. Otherwise, a new project will be created with given name.
To keep project clean, and avoid piling up virtual users and scenarios, OctoPerfEngine will remove any existing virtual users or scenarios created by jmeter-java-dsl (checking for jmeter-java-dsl tag). If you want to disable this logic check
projectCleanUp(boolean).It is important that you use a unique project name for each project, to avoid one project interfering with other projects entities.
When not specified, the project name defaults to "jmeter-java-dsl".
- Parameters:
projectName- specifies the name of the project to use in OctoPerf.- Returns:
- the engine for further configuration or usage.
-
totalUsers
public OctoPerfEngine totalUsers(int totalUsers)
Specifies the number of virtual users to use when running the test.This value overwrites any value specified in JMeter test plans thread groups.
When no configuration is given for totalUsers, rampUpFor or holdFor, then configuration will be taken from the first default thread group found in the test plan. Otherwise, when no totalUsers is specified, 1 user will be used.
- Parameters:
totalUsers- number of virtual users to run the test with.- Returns:
- the engine for further configuration or usage.
-
rampUpFor
public OctoPerfEngine rampUpFor(Duration rampUp)
Sets the duration of time taken to start the specified total users.For example if totalUsers is set to 10, rampUp is 1 minute and holdFor is 10 minutes, it means that it will take 1 minute to start the 10 users (starting them in a linear fashion: 1 user every 6 seconds), and then continue executing the test with the 10 users for 10 additional minutes.
This value overwrites any value specified in JMeter test plans thread groups.
When no configuration is given for totalUsers, rampUpFor or holdFor, then configuration will be taken from the first default thread group found in the test plan. Otherwise, when no ramp up is specified, 0 ramp-up will be used.
- Parameters:
rampUp- duration that OctoPerf will take to spin up all the virtual users.- Returns:
- the engine for further configuration or usage.
-
holdFor
public OctoPerfEngine holdFor(Duration holdFor)
Specifies the duration of time to keep the virtual users running, after the rampUp period.When specified, this value overwrites any value specified in JMeter test plans thread groups.
When no configuration is given for totalUsers, rampUpFor or holdFor, then configuration will be taken from the first default thread group found in the test plan. Otherwise, when no hold for is specified, 10 seconds hold for will be used.
- Parameters:
holdFor- duration to keep virtual users running after the rampUp period.- Returns:
- the engine for further configuration or usage.
-
testTimeout
public OctoPerfEngine testTimeout(Duration testTimeout)
Specifies a timeout for the entire test execution.If the timeout is reached then the test run will throw a TimeoutException.
It is strongly advised to set this timeout properly in each run, according to the expected test execution time plus some additional margin (to consider for additional delays in OctoPerf test setup and teardown).
This timeout exists to avoid any potential problem with OctoPerf execution not detected by the client, and avoid keeping the test indefinitely running until is interrupted by a user. This is specially annoying when running tests in automated fashion, for example in CI/CD.
When not specified, the default timeout will is set to 1 hour.
- Parameters:
testTimeout- to be used as time limit for test execution. If execution takes more than this, then a TimeoutException will be thrown by the engine.- Returns:
- the engine for further configuration or usage.
-
projectCleanUp
public OctoPerfEngine projectCleanUp(boolean enabled)
Allows enabling or disabling de automatic deletion of virtual users and scenarios from project.To avoid piling up virtual users and scenarios in the project, the OctoPerfEngine deletes, before creating new ones, all virtual users and scenarios previously created by jmeter-java-dsl (the ones that contain jmeter-java-dsl tag). This method allows to disable such logic.
- Parameters:
enabled- specifies to enable the automatic clean up or disable it when false. By default, this is set to true.- Returns:
- the engine for further configuration or usage.
-
run
public OctoPerfTestPlanStats run(File jmxFile, org.apache.jorphan.collections.HashTree tree, us.abstracta.jmeter.javadsl.core.BuildTreeContext context) throws IOException, InterruptedException, TimeoutException
- Specified by:
runin classBaseRemoteEngine<OctoPerfClient,OctoPerfTestPlanStats>- Throws:
IOExceptionInterruptedExceptionTimeoutException
-
buildClient
protected OctoPerfClient buildClient()
- Specified by:
buildClientin classBaseRemoteEngine<OctoPerfClient,OctoPerfTestPlanStats>
-
-