@Finally annotation can be used to define steps that should always execute regardless of the current execution status. For example, a step that could potentially be skipped due to an earier step failing can be instructed to execute unconditionally with this annotation.
Consider the following example.
Scenario: Onboard a new user
Given I am logged in as administator
When I register a new user
Then the new user should be able to login
And @Finally I log out as administrator
The last step in this example is annotated with
@Finally and will therefore always execute
If any of the preceeding steps (1 to 3) in this example fail or are skipped for whatever reason, then the last step will still execute!
Only the last step in a parent node (Background, Scenario, Outline, or
StepDef) can have this annotation.