Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

How can I reuse steps?

Philipp Dolder edited this page Jan 17, 2017 · 7 revisions

A useful way of reusing initial steps for many scenarios is to use Backgrounds.

However, when common steps need to take place after differing initial steps, or when only some scenarios in a class have common initial steps, background steps cannot be used and we need other strategies.

In all cases, it usually a good idea to encapsulate any heavy lifting in your steps in an internal DSL quite early so that most of your steps are left as one liners (see the code examples in http://adamralph.com/2012/07/28/new-background-attribute-in-xbehave-net-0-12-0/, Full example). This reduces the burden of repetition greatly and can often result in the best solution being to just repeat the steps.

The world of C#/{insert favourite .NET language here} is your oyster!

Clone this wiki locally