Writing test cases as step definitions with TypeScript
In this section, we will show you how to create step definitions to fulfil the feature file that we created in the previous section. A step definition is the actual implementation of the executable Specification by Examples. This means that we have the User Story in plain English so that both the business and technical teams will understand it. Then, we fulfil it with the code of the actual app and ensure that each step of the test case will pass each user scenario. The recommended procedure for BDD would be as follows:
- Come up with a User Story with Specification by Examples (SBE) first.
- The development team will pick up the executable specification and run it. The console will tell you that there is a failed test case that we need to implement for the step definitions.
- Write some code for the actual app that can pass the test case.
- Write the step definitions and rerun the tests.
- Refactor the code of the...