public class OctoPerfEngine extends Object implements DslJmeterEngine
DslJmeterEngine which allows running DslTestPlan in OctoPerf.| Constructor and Description |
|---|
OctoPerfEngine(String apiKey) |
| Modifier and Type | Method and Description |
|---|---|
OctoPerfEngine |
holdFor(Duration holdFor)
Specifies the duration of time to keep the virtual users running, after the rampUp period.
|
OctoPerfEngine |
projectCleanUp(boolean enabled)
Allows enabling or disabling de automatic deletion of virtual users and scenarios from
project.
|
OctoPerfEngine |
projectName(String projectName)
Sets the name of the OctoPerf project to use.
|
OctoPerfEngine |
rampUpFor(Duration rampUp)
Sets the duration of time taken to start the specified total users.
|
TestPlanStats |
run(DslTestPlan testPlan) |
OctoPerfEngine |
testTimeout(Duration testTimeout)
Specifies a timeout for the entire test execution.
|
OctoPerfEngine |
totalUsers(int totalUsers)
Specifies the number of virtual users to use when running the test.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitextractFirstThreadGrouppublic OctoPerfEngine(String apiKey)
apiKey - is the authentication token to be used to access OctoPerf API.
Check OctoPerf API keys for instructions on how to get it.
public OctoPerfEngine projectName(String projectName)
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".
projectName - specifies the name of the project to use in OctoPerf.public OctoPerfEngine totalUsers(int totalUsers)
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.
totalUsers - number of virtual users to run the test with.public OctoPerfEngine rampUpFor(Duration rampUp)
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.
rampUp - duration that OctoPerf will take to spin up all the virtual users.public OctoPerfEngine holdFor(Duration holdFor)
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.
holdFor - duration to keep virtual users running after the rampUp period.public OctoPerfEngine testTimeout(Duration testTimeout)
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.
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.public OctoPerfEngine projectCleanUp(boolean enabled)
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.
enabled - specifies to enable the automatic clean up or disable it when false. By default,
this is set to true.public TestPlanStats run(DslTestPlan testPlan) throws IOException, InterruptedException, TimeoutException
run in interface DslJmeterEngineIOExceptionInterruptedExceptionTimeoutExceptionCopyright © 2022. All rights reserved.