public class Locust extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
void |
dryRun(AbstractTask... tasks)
Run tasks without connecting to master.
|
void |
dryRun(List<AbstractTask> tasks)
Run tasks without connecting to master.
|
static Locust |
getInstance()
Get the locust singleton.
|
AbstractRateLimiter |
getRateLimiter()
Get the rate limiter
|
String |
getRemoteParam(String key)
Get remote params sent by the master, which will be set before spawning begins.
|
protected Runner |
getRunner() |
boolean |
isRateLimitEnabled()
Return rateLimitEnabled
|
boolean |
isVerbose()
已过时。
Since 1.0.8, we use slf4j as a logging facade without a particular logging framework.
|
void |
recordFailure(String requestType,
String name,
long responseTime,
String error)
Add a failed record, locust4j will collect it, and report to master.
|
void |
recordSuccess(String requestType,
String name,
long responseTime,
long contentLength)
Add a successful record, locust4j will collect it, calculate things like RPS, and report to master.
|
void |
run(AbstractTask... tasks)
Add tasks to Runner, connect to master and wait for messages of master.
|
void |
run(List<AbstractTask> tasks)
Add tasks to Runner, connect to master and wait for messages of master.
|
void |
setMasterHost(String masterHost)
Set the master host.
|
void |
setMasterPort(int masterPort)
Set the master port.
|
void |
setMaxRPS(long maxRPS)
Limit max PRS that locust4j can generator.
|
void |
setRateLimiter(AbstractRateLimiter rateLimiter)
Set the rate limiter
|
void |
setVerbose(boolean v)
已过时。
Since 1.0.8, we use slf4j as a logging facade without a particular logging framework.
|
void |
stop()
Stop locust
|
public static Locust getInstance()
public void setMasterHost(String masterHost)
masterHost - the master hostpublic void setMasterPort(int masterPort)
masterPort - the master portpublic void setMaxRPS(long maxRPS)
maxRPS - max rpspublic AbstractRateLimiter getRateLimiter()
public void setRateLimiter(AbstractRateLimiter rateLimiter)
rateLimiter - builtin or custom rate limiterpublic boolean isRateLimitEnabled()
public boolean isVerbose()
public void setVerbose(boolean v)
v - set true to print outprotected Runner getRunner()
public void run(AbstractTask... tasks)
tasks - test taskspublic void run(List<AbstractTask> tasks)
tasks - test taskspublic void dryRun(AbstractTask... tasks)
tasks - test taskspublic void dryRun(List<AbstractTask> tasks)
tasks - test taskspublic void stop()
public void recordSuccess(String requestType, String name, long responseTime, long contentLength)
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 bytespublic void recordFailure(String requestType, String name, long responseTime, String error)
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 messagepublic String getRemoteParam(String key)
key - remote param keyCopyright © 2020. All rights reserved.