I’ve started learning BDD but I think I have some misunderstanding of how to use it correctly.
Currently I’m writing an API for a product. This API will be used by other developers only. Is it ok to write features and scenarios from the developer point of view? Something like:
Feature: Authorization
In order to access program runtime
As a module developer
I want to ensure that authorization is done correctly
Scenario: Login with wrong credentials
Given I have login "login" and password "pass"
When I try to login
Then the exception with message "Some message" must be thrown
Or maybe it’s better to stick with simple unit testing for such tasks?
If the users of your deliverable were dentists, then a scenario would have to be written from the point of view of a dentist, and understandable to him. If the users are all programmers, then it must be written from the viewpoint of a programmer. The fact that programmers will also be the ones who create the system is irrelevant, just like the fact that the programmers of the hypothetical first system also occasionally visit dentists. It’s always the role that someone fulfills in a particular interaction that determines what to present and how, not the entirety of their personality.
3