Consider the following simple example of a scenario:

This scenario gives a one-time promotion to newly registered users of a bike store. Young people will get 25% off BMX bikes if they visit any bike-related pages in the store; female users will get 20% off their order if they view any clothing items.

One can think of a scenario as a channel or pipe through which subjects (users) flow. At the start of the scenario, the set of all users (whether currently active or not) are in the pipe. As subjects move down the channel, they encounter scenario elements that affect their progress in various ways. Events (such as “Registers”) prevent the subject from proceeding further until the event occurs. Condition elements (such as “in group Young”) narrow the set of subjects passing through the pipe; only those subjects who satisfy the condition can proceed further. Action elements (such as “Give Promotion”) carry out some action (usually relative to the subject). Finally, the pipe may fork, in which case subjects flow down multiple branches in the fork, which diverge and then rejoin. There are two kinds of forks: regular (the subject leaves the fork as soon as it arrives at the join point via one or more paths), and synchronized (the subject leaves the fork only when all paths in the fork arrive at the join point).

In the example, if the user doesn’t qualify as either young or female, he does not proceed past the “Registers” element in the scenario. A young male proceeds via the upper branch in the fork, where the scenario must wait for him to visit an appropriate page before giving him the promotion; likewise, an old female proceeds via the lower branch. A user who is both young and female proceeds via both branches; the promotion she gets depends on which of the two events (“Visits a page” or “Views an item”) happens first. Because the fork is regular, once she does receive one of the promotions, she will exit the fork and exit the scenario.

loading table of contents...