funspec

ScalaTest 103: Writing a first BDD test with ScalaTest

Problem: You want to write your ScalaTest tests using a behavior-driven development (BDD) style.

Solution

Extend the ScalaTest FunSpec trait, typically with the BeforeAndAfter trait. Then use the approach shown in the following PizzaSpec test class.

A series of tests begins with the describe method, with individual tests declared in it methods: