public abstract class AbstractTask extends Object implements Runnable
AbstractTask is the abstraction layer of test scenario, which requires subtypes to implement test scenario
in execute() method.
Instances of task is shared across multiple threads, the execute() method must be thread-safe.
If you call locust.run(new AwesomeTask()), only one instance of AwesomeTask is used by multiple threads.
This behavior is different from locust in python.| 构造器和说明 |
|---|
AbstractTask() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
execute()
Test scenarios should be implemented in this method, like sending http request.
|
abstract String |
getName()
Get the name of task.
|
abstract int |
getWeight()
When locust runs multiple tasks, their weights are used to allocate threads.
|
void |
run() |
public abstract int getWeight()
public abstract String getName()
public abstract void execute()
throws Exception
Exception - test scenarios may throw exception.Copyright © 2019. All rights reserved.