类 Locust
java.lang.Object
com.github.myzhan.locust4j.Locust
Locust class exposes all the APIs of locust4j.
Use Locust.getInstance() to get a Locust singleton.
- 作者:
- myzhan
-
方法概要
修饰符和类型方法说明voiddryRun(AbstractTask... tasks) Run tasks without connecting to master.voiddryRun(List<AbstractTask> tasks) Run tasks without connecting to master.static LocustGet the locust singleton.Get the rate limitergetRemoteParam(String key) Get remote params sent by the master, which will be set before spawning begins.protected RunnerbooleanReturn rateLimitEnabledboolean已过时。Since 1.0.8, we use slf4j as a logging facade without a particular logging framework.voidrecordFailure(String requestType, String name, long responseTime, String error) Add a failed record, locust4j will collect it, and report to master.voidrecordSuccess(String requestType, String name, long responseTime, long contentLength) Add a successful record, locust4j will collect it, calculate things like RPS, and report to master.voidrun(AbstractTask... tasks) Add tasks to Runner, connect to master and wait for messages of master.voidrun(List<AbstractTask> tasks) Add tasks to Runner, connect to master and wait for messages of master.voidsetMasterHost(String masterHost) Set the master host.voidsetMasterPort(int masterPort) Set the master port.voidsetMaxRPS(long maxRPS) Limit max PRS that locust4j can generator.voidsetRateLimiter(AbstractRateLimiter rateLimiter) Set the rate limiterprotected voidvoidsetVerbose(boolean v) 已过时。Since 1.0.8, we use slf4j as a logging facade without a particular logging framework.voidstop()Stop locust
-
方法详细资料
-
getInstance
-
setMasterHost
Set the master host.- 参数:
masterHost- the master host- 从以下版本开始:
- 1.0.0
-
setMasterPort
public void setMasterPort(int masterPort) Set the master port.- 参数:
masterPort- the master port- 从以下版本开始:
- 1.0.0
-
setMaxRPS
public void setMaxRPS(long maxRPS) Limit max PRS that locust4j can generator.- 参数:
maxRPS- max rps- 从以下版本开始:
- 1.0.0
-
getRateLimiter
-
setRateLimiter
Set the rate limiter- 参数:
rateLimiter- builtin or custom rate limiter- 从以下版本开始:
- 1.0.3
-
isRateLimitEnabled
public boolean isRateLimitEnabled()Return rateLimitEnabled- 返回:
- is rate limiter enabled?
- 从以下版本开始:
- 1.0.3
-
isVerbose
public boolean isVerbose()已过时。Since 1.0.8, we use slf4j as a logging facade without a particular logging framework.- 返回:
- is it verbose?
- 从以下版本开始:
- 1.0.2
-
setVerbose
public void setVerbose(boolean v) 已过时。Since 1.0.8, we use slf4j as a logging facade without a particular logging framework.Print out the internal log of locust4j, or not.- 参数:
v- set true to print out- 从以下版本开始:
- 1.0.2
-
setRunner
-
getRunner
-
run
Add tasks to Runner, connect to master and wait for messages of master.- 参数:
tasks- test tasks- 从以下版本开始:
- 1.0.0
-
run
Add tasks to Runner, connect to master and wait for messages of master.- 参数:
tasks- test tasks- 从以下版本开始:
- 1.0.0
-
dryRun
Run tasks without connecting to master.- 参数:
tasks- test tasks- 从以下版本开始:
- 1.0.0
-
dryRun
Run tasks without connecting to master.- 参数:
tasks- test tasks- 从以下版本开始:
- 1.0.0
-
stop
public void stop()Stop locust- 从以下版本开始:
- 1.0.7
-
recordSuccess
Add a successful record, locust4j will collect it, calculate things like RPS, and report to master.- 参数:
requestType- locust use request type to classify test resultsname- like request type, used by locust to classify test resultsresponseTime- how long does it take for a single test scenario, in milliscontentLength- content length in bytes- 从以下版本开始:
- 1.0.0
-
recordFailure
Add a failed record, locust4j will collect it, and report to master.- 参数:
requestType- locust use request type to classify test resultsname- like request type, used by locust to classify test resultsresponseTime- how long does it take for a single test scenario, in milliserror- error message- 从以下版本开始:
- 1.0.0
-
getRemoteParam
Get remote params sent by the master, which will be set before spawning begins. But Locust has not documentations about the data protocol. It may change and this method will return null with the same key.- 参数:
key- remote param key- 返回:
- remote param value
- 从以下版本开始:
- 1.0.11
-