Пользуясь Cucumber около года назад, я привык писать сценарии таким образом.
Scenario: user tries to vote on a comment
Given I have a post
And I have a comment on that post
And I am logged in as a different user
And I am on the post page
When I click on "upvote" within the "comment"
Then the comment score should raise
And the comment author should get points
однако недавно я обнаружил, что начиная с Cucumber 1.1, основные определения шагов, такие как
When I click on "upvote" within the "comment"
больше не доступны, так как считаются плохой практикой. Я понимаю, как это имеет смысл, но я не совсем уверен, насколько абстрактно я должен написать свои функции сейчас.
Примеры, которые приходят на ум.
When I upvote on a comment
Then the comment should get points
или менее абстрактный
Given I have a post with a comment
And I'm not the author
When I upvote on the comment
Then the comment author should get points
или даже менее абстрактный
Given I have a post with a comment
And I'm not the author
When I upvote on the comment
Then the comment score should increase
And the comment author should get 1 point
или очень специфично в Given
части
Given I have a post with a comment
And I'm not the author
And I am on the page for that post
When I upvote on the comment
Then the comment score should increase
And the comment author should get 1 point
Я знаю, что это вопрос предпочтения, но я пытаюсь найти здесь несколько лучших практик. Какой лучший способ указать сценарии?