Writing Performables
Screenplay and add-on libraries will ship with pre-created Actions and Questions, two of the three types of Performable. Developers making use of Screenplay might not need to write new Actions or Questions, because they may use and compose the existing ones.
On the other hand, it is very likely that developers will need to write Tasks, which are the kind of Performable which composes Actions, Questions and/or other Tasks.
A sample Task
Here is an annotated example of a Task which makes use of a fictitious Action and a fictitious Question.
TODO: Write this docco
Guidelines for writing performables
The following list shows some guidelines for writing new performables. These apply equally across ask if the three types of performables, even though developers are mainly expected to be writing tasks.
- Implement precisely one performable interface
- Implement
ICanReport
- Parameterize low-level performables
- Avoid branching logic
- Performables should be stateful but immutable
- Allow cooperative cancellation
- Write a builder
- Do not rely on a DI framework
- Aim for Pure Functional tasks
- Do not interact with Abilities from Tasks