Table of Contents

Performable

A 'performable' is a verb in the language of Screenplay; performables are things that Actors do. Performables are logically grouped into one of the following three kinds. Do not be mistaken in believing that these three kinds of performable correspond to the three interfaces which are listed later on this page. This is entirely coincidental and there is no direct equivalence.

  • Actions are the most granular of individual interactions with the application, composable to form higher-order interactions
  • Questions are granular, like actions, but read the application's state to get information instead of making changes
  • Tasks are higher-order interactions which are formed by composing actions, questions and/or other tasks

Performable instances are not reusable

Types which implement the performable interfaces (below) are stateful objects which are often mutable. Their state defines their configuration, as such, instances of any performable type must not be reused.

Typically, performables are created using a builder which configures their state. Each performable object is used precisely once by an actor and then discarded. Even if you would like to perform the same operation twice, do not attempt to reuse an object instance; use the builder twice to create two (identical) instances of the same performable type.

Developers using Screenplay will typically be writing Tasks

Actions & Questions are the smallest/low-level building blocks of a Screenplay Performance. They are parameterized and should make as few assumptions as possible. As such, they should be highly reusable. Actions & Questions rarely need to be written by developers who are using Screenplay. That is because most likely, the Action, Question and corresponding Ability classes will have been provided in a library, such as a NuGet package.

On the other hand, Tasks are higher-level performables which may compose Actions, Questions and/or other lower-level Tasks. Developers using Screenplay should write as many Tasks as they need. Tasks may represent any of the - possibly complex - interactions performed by the Actor. Actions & Questions should interact directly with the Actor's Abilities to perform their logic; in most cases Tasks should not directly use any Abilities.

When writing your own performables, consider these best practices for the best results.

The three performable interfaces, and ICanReport

In Screenplay code, a Performance is a script of sorts, written from at least one performable, usually several. All performables must implement one of the following three interfaces, but it's also strongly recommended to implement ICanReport as well. As noted above, it is coincidence alone that there are three kinds of performable and three interfaces for performables. There is no direct correlation between these interfaces and the kinds of performable.