[−][src]Struct goose::goose::GooseTask
An individual task within a GooseTaskSet
.
Fields
tasks_index: usize
An index into GooseTaskSet.task, indicating which task this is.
name: String
An optional name for the task, used when displaying statistics about requests made.
weight: usize
An integer value that controls the frequency that this task will be run.
sequence: usize
An integer value that controls when this task runs compared to other tasks in the same GooseTaskSet.
on_start: bool
A flag indicating that this task runs when the client starts.
on_stop: bool
A flag indicating that this task runs when the client stops.
function: fn(_: &mut GooseClient)
A required function that is executed each time this task runs.
Methods
impl GooseTask
[src]
pub fn new(function: fn(_: &mut GooseClient)) -> Self
[src]
pub fn set_name(self, name: &str) -> Self
[src]
Set an optional name for the task, used when displaying statistics about requests made by the task.
Example
GooseTask::new(my_task_function).set_name("foo");
pub fn set_on_start(self) -> Self
[src]
Set an optional flag indicating that this task should be run when a client first starts. This could be used to log the user in, and so all subsequent tasks are done as a logged in user. A task with this flag set will only run at start time (and optionally at stop time as well, if that flag is also set).
On-start tasks can be sequenced and weighted. Sequences allow multiple on-start tasks to run in a controlled order. Weights allow on-start tasks to run multiple times when a client starts.
Example
GooseTask::new(my_on_start_function).set_on_start();
pub fn set_on_stop(self) -> Self
[src]
Set an optional flag indicating that this task should be run when a client stops. This could be used to log a user out when the client finishes its load test. A task with this flag set will only run at stop time (and optionally at start time as well, if that flag is also set).
On-stop tasks can be sequenced and weighted. Sequences allow multiple on-stop tasks to run in a controlled order. Weights allow on-stop tasks to run multiple times when a client stops.
Example
GooseTask::new(my_on_stop_function).set_on_stop();
pub fn set_weight(self, weight: usize) -> Self
[src]
Sets a weight on an individual task. The larger the value of weight, the more often it will be run in the TaskSet. For example, if one task has a weight of 3 and another task has a weight of 1, the first task will run 3 times as often.
Example
GooseTask::new(task_function).set_weight(3);
pub fn set_sequence(self, sequence: usize) -> Self
[src]
Defines the sequence value of an individual tasks. Tasks are run in order of their sequence value, so a task with a sequence value of 1 will run before a task with a sequence value of 2. Tasks with no sequence value will run last, after all tasks with sequence values.
All tasks with the same sequence value will run in a random order. Tasks can be assigned both squence values and weights.
Example
let runs_first = GooseTask::new(first_task_function).set_sequence(3); let runs_second = GooseTask::new(second_task_function).set_sequence(5835); let runs_last = GooseTask::new(third_task_function);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for GooseTask
impl Send for GooseTask
impl Sync for GooseTask
impl Unpin for GooseTask
impl UnwindSafe for GooseTask
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,