BDD
A test suite begins with a call to our TestBox describe()
function with at least two arguments: a title
and a body
closure within the life-cycle method called run()
. The title
is the name of the suite to register and the body
function is the block of code that implements the suite. There are more arguments which you can see below:
In BDD, suites can be nested within each other which provides a great capability of building trees of tests. Not only does it arrange them in tree format but also TestBox will execute the life-cycle methods in order of nested suites as it traverses the tree.
BDD Specs
Specs are defined by calling the TestBox it()
global function, which takes in a title and a function. The title is the title of this spec or test you will write and the function is a block of code that represents the test/spec. A spec will contain most likely one or more expectations that will test the state of the SUT (software under test) or sometimes referred to as code under test.
An expectation is a nice assertion DSL that TestBox exposes so you can pretty much read what should happen in the testing scenario. A spec will pass if all expectations pass. A spec with one or more expectations that fail will fail the entire spec.
Last updated