​ IBehaviou r - Defines the interfaces for all behaviours. Contains only a single Execute method.

- Defines the interfaces for all behaviours. Contains only a single method. AssertBehaviour - The base class for all assert-only behaviours. Contains two methods- Assert and Execute .

- The base class for all assert-only behaviours. Contains two methods- and . ActionBehaviour - The base class for all actions-only behaviours. Contains only two methods PerformAct and Execute .

- The base class for all actions-only behaviours. Contains only two methods and . WaitableActionBehaviour - Base class for all more complex behaviours that can contain simultaneously actions, asserts and wait logic.

- Base class for all more complex behaviours that can contain simultaneously actions, asserts and wait logic. UnityContainerFactory - A class that creates and holds a single global instance to a Unity IoC container.

- A class that creates and holds a single global instance to a Unity IoC container. ItemPageNavigationBehaviour - A concrete behaviour for the ItemPage class. It holds a logic for navigation. Its is an action behaviour.

- A concrete behaviour for the ItemPage class. It holds a logic for navigation. Its is an action behaviour. ItemPage - A concrete page object that provides different service operations that can be performed on the page. It is used in the specific behaviours.

- A concrete page object that provides different service operations that can be performed on the page. It is used in the specific behaviours. BehaviourExecutor - It is the class that executes the list of behaviours' workflows.

What Are the Problems That We Try to Solve?

In the previous examples, there was one major problem and that was the inability to pass properly the parameters to the behaviours. They all depended on a static test context class. As you probably know, the usage of static is not a best practice. The another issue that I saw was that the workflow's definition in the ExecutionEngine was somehow not flexible. If you need to add a new step you need to apply the change in the primary class that almost all tests depend on. I wanted to improve the flexibility of the tests.

Behaviours Design Pattern C# Code

One of the main differences compared to the previous examples is that the IBehaviour interface contains only a single method- Execute.

IBehaviour Interface Changes