public class BlazeMeterEngine extends Object implements DslJmeterEngine
DslJmeterEngine which allows running DslTestPlan in BlazeMeter.| Constructor and Description |
|---|
BlazeMeterEngine(String authToken) |
| Modifier and Type | Method and Description |
|---|---|
BlazeMeterEngine |
availableDataTimeout(Duration availableDataTimeout)
Specifies a timeout for waiting for test data (metrics) to be available in BlazeMeter.
|
BlazeMeterEngine |
holdFor(Duration holdFor)
Specifies the duration of time to keep the virtual users running, after the rampUp period.
|
BlazeMeterEngine |
iterations(int iterations)
Specifies the number of iterations each virtual user will execute.
|
BlazeMeterEngine |
projectId(long projectId)
Specifies the ID of the BlazeMeter project where to run the test.
|
BlazeMeterEngine |
rampUpFor(Duration rampUp)
Sets the duration of time taken to start the specified total users.
|
TestPlanStats |
run(DslTestPlan testPlan) |
BlazeMeterEngine |
testName(String testName)
Sets the name of the BlazeMeter test to use.
|
BlazeMeterEngine |
testTimeout(Duration testTimeout)
Specifies a timeout for the entire test execution.
|
BlazeMeterEngine |
threadsPerEngine(int threadsPerEngine)
Specifies the number of threads/virtual users to use per BlazeMeter engine (host or
container).
|
BlazeMeterEngine |
totalUsers(int totalUsers)
Specifies the number of virtual users to use when running the test.
|
BlazeMeterEngine |
useDebugRun()
Specifies that the test run will use BlazeMeter debug run feature, not consuming credits but
limited up to 10 threads and 5 minutes or 100 iterations.
|
public BlazeMeterEngine(String authToken)
authToken - is the authentication token to be used to access BlazeMeter API.
It follows the following format: <Key ID>:<Key Secret>.
Check BlazeMeter API keys for instructions on how to generate them.
public BlazeMeterEngine testName(String testName)
BlazeMeterEngine will search for a test with the given name in the given project (Check projectId(long)) and if one exists, it will update it and use it to run the provided test
plan. If a test with the given name does not exist, then it will create a new one to run the
given test plan.
When not specified, the test name defaults to "jmeter-java-dsl".
testName - specifies the name of the test to update or create in BlazeMeter.public BlazeMeterEngine projectId(long projectId)
You can get the ID of the project by selecting a given project in BlazeMeter and getting the number right after "/projects" in the URL.
When no project ID is specified, then the default one for the user (associated to the given authentication token) is used.
projectId - is the ID of the project to be used to run the test.public BlazeMeterEngine 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 BlazeMeter test setup and teardown).
This timeout exists to avoid any potential problem with BlazeMeter 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 BlazeMeterEngine availableDataTimeout(Duration availableDataTimeout)
After a test is marked as ENDED in BlazeMeter, it may take a few seconds for the associated final metrics to be available. In some cases, the test is marked as ENDED by BlazeMeter, but the data is never available. This usually happens when there is some problem running the test (for example some internal problem with BlazeMeter engine, some missing jmeter plugin, or some other jmeter error). This timeout makes sure that tests properly fail (throwing a TimeoutException) when they are marked as ENDED and no data is available after the given timeout, and avoids unnecessary wait for test execution timeout.
Usually this timeout should not be necessary to change, but the API provides such method in case you need to tune such setting.
When not specified, this value will default to 30 seconds.
availableDataTimeout - to wait for available data after a test ends, before throwing a
TimeoutException.public BlazeMeterEngine totalUsers(int totalUsers)
This value overwrites any value specified in JMeter test plans thread groups.
When not specified, then the last test run (with same name) value or 1 (if none has ever been specified) will be used.
totalUsers - number of virtual users to run the test with.public BlazeMeterEngine 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.
Take into consideration that BlazeMeter does not support specifying this value in units more granular than minutes, so, if you use a finer grain duration, it will be rounded up to minutes (eg: if you specify 61 seconds, this will be translated into 2 minutes).
When not specified, the last test run (with same name) value or 0 (if none has ever been specified) will be used.
rampUp - duration that BlazeMeter will take to spin up all the virtual users.public BlazeMeterEngine iterations(int iterations)
If both iterations and holdFor are specified, then iterations are ignored and only holdFor is taken into consideration.
When neither iterations and holdFor are specified, then the last test run configuration is used, or the criteria specified in the JMeter test plan if no previous test run exists.
When specified, this value overwrites any value specified in JMeter test plans thread groups.
iterations - for each virtual users to execute.public BlazeMeterEngine holdFor(Duration holdFor)
If both iterations and holdFor are specified, then iterations are ignored and only holdFor is taken into consideration.
When neither iterations and holdFor are specified, then the last test run configuration is used, or the criteria specified in the JMeter test plan if no previous test run exists.
Take into consideration that BlazeMeter does not support specifying this value in units more granular than minutes, so, if you use a finer grain duration, it will be rounded up to minutes (eg: if you specify 61 seconds, this will be translated into 2 minutes).
When specified, this value overwrites any value specified in JMeter test plans thread groups.
holdFor - duration to keep virtual users running after the rampUp period.public BlazeMeterEngine threadsPerEngine(int threadsPerEngine)
It is always important to use as less resources (which reduces costs) as possible to generate the required load for the test. Too few resources might lead to misguiding results, since the instances/engines running might be saturating and not properly imposing the expected load upon the system under test. Too many resources might lead to unnecessary expenses (wasted money).
This setting, in conjunction with totalUsers, determine the number of engines BlazeMeter will use to run the test. For example, if you specify totalUsers to 500 and 100 threadsPerEngine, then 5 engines will be used to run the test.
It is important to set this value appropriately, since different test plans may impose different load in BlazeMeter engines. This in turns ends up defining different limit of number of virtual users per engine that a test run requires to properly measure the performance of the system under test. This process is usually referred as "calibration" and you can read more about it here.
When not specified, the value of the last test run will be used, or the default one for your BlazeMeter billing plan if no previous test run exists.
threadsPerEngine - the number of threads/virtual users to execute per BlazeMeter engine.public BlazeMeterEngine useDebugRun()
public TestPlanStats run(DslTestPlan testPlan) throws IOException, InterruptedException, TimeoutException
run in interface DslJmeterEngineIOExceptionInterruptedExceptionTimeoutExceptionCopyright © 2021. All rights reserved.