Actor
Tests:
- Actor can be identified by their name
- Actor provides a developer-friendly toString
- Actor has Abilities allowing them to perform Activities and interact with a given interface of the system under test
- Actor performs composite Tasks recursively to accomplish their Business Goals
- Actor asks Questions about the state of the system fulfills the promise should the question be answered as expected
- Actor asks Questions about the state of the system rejects the promise should the answer differ from what was expected
- Actor when using abilities admits if it does not have the Ability necessary to accomplish a given Interaction
- Actor when using abilities complains if given the same ability twice
- Actor when using abilities that have to be initialised initialises them upon the first call to attemptsTo
- Actor when using abilities that have to be initialised
- Actor when using abilities that have to be initialised
- Actor DomainEvent handling announces events about the activities it performs notifies when an activity begins and ends
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
abilityTo(doSomething: *): * Retrieves actor's Ability to Please note that this method performs an |
|
public |
answer(answerable: Answerable<T>): Promise<T> |
|
public |
attemptsTo(activities: ...activities: Activity[]): Promise<void> Instructs the actor to attempt to perform a number of activities (see Activity, so either Tasks or Interactions) one by one. |
|
public |
Announce collection of an Artifact so that it can be picked up by a StageCrewMember. |
|
public |
dismiss(): Promise<void> Instructs the actor to invoke Discardable#discard method on any Discardable Ability it's been configured with. |
|
public |
toString(): string Returns a human-readable, string representation of this Actor |
|
public |
Gives this Actor a list of abilities (see Ability) they can use to interact with the system under test or the test environment. |
Public Constructors
public constructor() source
Public Methods
public abilityTo(doSomething: *): * source
Retrieves actor's Ability to doSomething
.
Please note that this method performs an instancepf
check against abilities given to this actor via Actor#whoCan. Please also note that Actor#whoCan performs
the same check when abilities are assigned to the actor to ensure the actor has at most one instance of a given ability type.
Params:
Name | Type | Attribute | Description |
doSomething | * |
Returns:
* |
public answer(answerable: Answerable<T>): Promise<T> source
Params:
Name | Type | Attribute | Description |
answerable | Answerable<T> | a Question<Promise<T>>, Question<T>, Promise<T> or T |
Returns:
Promise<T> | The answer to the Answerable |
public attemptsTo(activities: ...activities: Activity[]): Promise<void> source
Instructs the actor to attempt to perform a number of activities (see Activity, so either Tasks or Interactions) one by one.
Params:
Name | Type | Attribute | Description |
activities | ...activities: Activity[] |
Returns:
Promise<void> |
public collect(artifact: Artifact, name: string | Name): void source
Announce collection of an Artifact so that it can be picked up by a StageCrewMember.
Params:
Name | Type | Attribute | Description |
artifact | Artifact | ||
name | string | Name |
|
Returns:
void |
public dismiss(): Promise<void> source
Instructs the actor to invoke Discardable#discard method on any Discardable Ability it's been configured with.
Returns:
Promise<void> |
public toString(): string source
Returns a human-readable, string representation of this Actor
Returns:
string |
public whoCan(abilities: ...Ability[]): Actor source
Gives this Actor a list of abilities (see Ability) they can use to interact with the system under test or the test environment.
Params:
Name | Type | Attribute | Description |
abilities | ...Ability[] | A vararg list of abilities to give the actor |
Throws:
Throws a ConfigurationError if the actor already has an ability of this type. |