public interface BackendListenerClient
JMeter will create one instance of a BackendListenerClient implementation for each user/thread in the test. Additional instances may be created for internal use by JMeter (for example, to find out what parameters are supported by the client).
When the test is started, setupTest() will be called on each thread's BackendListenerClient instance to initialize the client. Then handleSampleResult() will be called for each SampleResult notification. Finally, teardownTest() will be called to allow the client to do any necessary clean-up.
The JMeter BackendListener GUI allows a list of parameters to be defined for the
test. These are passed to the various test methods through the
BackendListenerContext
. A list of default parameters can be defined
through the getDefaultParameters() method. These parameters and any default
values associated with them will be shown in the GUI. Users can add other
parameters as well.
When possible, Listeners should extend AbstractBackendListenerClient
rather than implementing BackendListenerClient
directly. This should protect your tests from future changes to the
interface. While it may be necessary to make changes to the BackendListenerClient
interface from time to time (therefore requiring changes to any
implementations of this interface), we intend to make this abstract class
provide reasonable default implementations of any new methods so that
subclasses do not necessarily need to be updated for new versions.
Implementing BackendListenerClient directly will continue to be supported for
cases where extending this class is not possible (for example, when the
client class is already a subclass of some other class).
Modifier and Type | Method and Description |
---|---|
SampleResult |
createSampleResult(BackendListenerContext context,
SampleResult result)
Create a copy of SampleResult, this method is here to allow customizing
what is kept in the copy, for example copy could remove some useless fields.
|
Arguments |
getDefaultParameters()
Provide a list of parameters which this test supports.
|
void |
handleSampleResults(java.util.List<SampleResult> sampleResults,
BackendListenerContext context)
Handle sampleResults, this can be done in many ways:
Write to a file
Write to a distant server
...
|
void |
setupTest(BackendListenerContext context)
Do any initialization required by this client.
|
void |
teardownTest(BackendListenerContext context)
Do any clean-up required at the end of a test run.
|
void setupTest(BackendListenerContext context) throws java.lang.Exception
context
- the context to run with. This provides access to
initialization parameters.
Context is readonlyjava.lang.Exception
- when setup failsvoid handleSampleResults(java.util.List<SampleResult> sampleResults, BackendListenerContext context)
sampleResults
- List of SampleResult
context
- the context to run with. This provides access to
initialization parameters.void teardownTest(BackendListenerContext context) throws java.lang.Exception
context
- the context to run with. This provides access to
initialization parameters.java.lang.Exception
- when tear down failsArguments getDefaultParameters()
SampleResult createSampleResult(BackendListenerContext context, SampleResult result)
context
- BackendListenerContext
result
- SampleResult
SampleResult
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.