Skip to content

Implementation of the Screenplay pattern (aka Journey) for BDD acceptance tests

License

Notifications You must be signed in to change notification settings

RhodeHummel/CSF.Screenplay

 
 

Repository files navigation

CSF.Screenplay

Screenplay is a design pattern for writing BDD tests; it has formerly been known as the Journey pattern. Screenplay helps developers write high-value test logic:

  • It encourages human-readable test code
  • Screenplay follows the SOLID design principles, aiding reusability
  • Screenplay keeps tests focussed upon actors how they use the software under test
  • Detailled human-readable reports are produced at the end of every test run
  • It is an ideal framework for controlling technologies such as Selenium Web Driver

The CSF.Screenplay library is inspired by Serenity, a testing framework which includes a Java implementation of the Screenplay pattern.

Example test

The preferred integration for Screenplay is SpecFlow. This example uses NUnit instead though, as it is more concise and more widely recognised.

[TestFixture]
[Description("Users should be able to buy groceries via the web application")]
public class UsersCanBuyGroceries
{
  [Test,Screenplay]
  [Description("Joe should see a thankyou message when he uses the web application to buy eggs.")]
  public void JoeShouldSeeAThankyouMessageWhenHeBuysEggs(ICast cast, BrowseTheWeb browseTheWeb)
  {
    var joe = cast.Get("Joe")
    joe.IsAbleTo(browseTheWeb);

    Given(joe).WasAbleTo(SearchTheShop.ForGroceries());
    When(joe).AttemptsTo(Click.On(GroceriesForSale.BuyEggsButton));
    var message = Then(joe).ShouldSee(TheText.Of(GroceriesForSale.FeedbackMessage));

    Assert.That(message, Is.EqualTo("Thankyou for buying eggs."));
  }
}

Continuous integration status

CI builds are configured via both Travis (for build & test on Linux/Mono) and AppVeyor (Windows/.NET). Below are links to the most recent build statuses for these two CI platforms.

Platform Status
Linux/Mono (Travis) Travis Status
Windows/.NET (AppVeyor) AppVeyor status

About

Implementation of the Screenplay pattern (aka Journey) for BDD acceptance tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 95.1%
  • HTML 1.5%
  • CSS 1.4%
  • Shell 0.9%
  • JavaScript 0.7%
  • Gherkin 0.3%
  • Other 0.1%