Autocomplete and step reuse

The AssertThat BDD plugin has a number of features to help writing BDD Features, Scenarios and Steps. In this section we will cover Autocomplete which will speeds up your teams ability to write scenarios by reusing steps over and over again.

Autocomplete

Step 1: Access the features menu.

Step 2: Select the Feature you would like to add the new Scenario to, by clicking on the Scenario title.

Step 3: Enter step type (Given, When, Then, But) then start to type in an existing step, when you have typed 3 Characters press CTRL-SPACE you will be presented with a list of potential steps that can be reused. Continue typing to narrow down steps that match existing steps.

Step Autocomplete - start typing then press CTRL-SPACE

Step reuse - Drag and Drop

Step 1: Access the features menu.

Step 2: Select the Feature you would like to add the new Scenario to, by clicking on the Scenario title.

image-20240331-123027.png
Navigate to the scenarios to edit

Step 3: Select Toggle Autocomplete. A new window appears which will move as you scroll up and down the page.

Step 4: Start typing an existing step in the Autocomplete box, and a list of steps that match your criteria will be displayed.

Step 5: Simply select the position of where you want the new step and then drag and drop the step from the Autocomplete box.

Scoped autocomplete per component

In order to logically separate steps that are being suggested in autocomplete you can use feature level tags of specific format (component:<component_name>)to group the features into components. Autocomplete in a feature with feature level component tag will be scoped to the component and won’t suggest steps from features in different components.

For example if Feature A and B has tag component:X and Feature C and D has tag component:Y, then when writing scenario in Feature C autocomplete won’t show steps from Features A and B but will only suggest steps from Features C and D.

Example of feature level components tags below: