Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 2.4 KB

File metadata and controls

40 lines (26 loc) · 2.4 KB
description
Describe(), Feature(), Scenario(), Given(), When()

Suites: Describe Your Tests

A test suite in TestBox is a collection of specifications that model what you want to test. As we will investigate, the way the suite is expressed can be of many different types.

Test suite is a container that has a set of tests which helps testers in executing and reporting the test execution status.

A test suite begins with a call to our TestBox describe() function with at least two arguments: a title and a body function/closure. The title is the name of the suite to register and the body function/closure is the block of code that implements the suite.

When applying BDD to your tests, this function is used to describe your story scenarios that you will implement.

function run( testResults, testBox ){

     describe("A suite", function(){
          it("contains spec with an awesome expectation", function(){
               expect( true ).toBeTrue();
          });
          it("contains spec with a failure expectation", function(){
               expect( true ).toBeFalse();
          });
     });

}

{% hint style="success" %} The describe() function is also aliased with the following names:story(), feature(), scenario(), given(), when() {% endhint %}

Arguments

There are more arguments, which you can see below:

ArgumentRequiredDefaultTypeDescription
ArgumentRequiredDefaultTypeDescription
titletrue---stringThe title of the suite to register
bodytrue---closure/udfThe closure that represents the test suite
labelsfalse---string/arrayThe list or array of labels this suite group belongs to
asyncAllfalsefalseBooleanIf you want to parallelize the execution of the defined specs in this suite group.
skipfalsefalseBooleanA flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.