我在尋找一些背景信息,發光功能和情況之間的差異。什麼時候是一個功能,當情景
說,我有一個文件use_administration.feature
Feature: Use administration area
So that I can administrate the application
As an administrator
I can visit the administration area
Scenario: Get a login form
Given I am not logged in
When I visit the administration dashboard
Then I should see a login-form
Scenario: Access the Dashboard
Given I am not logged in
And there is a user "[email protected]" with password "password"
When I log in with username "[email protected]" and password "password"
Then I should see a dashboard
我會考慮這些方案的很好定義。
然而,看着另一個Feature
時,該問題變得更加清晰
Feature: Manage campings
So that a writer can manage her campings
As a logged in writer
I want to update and delete campings
Scenario: Logged in writer can create a new camping
Given I am administrator
And no campings on the campings listing
When I create a Camping named "Beautifull Green"
And I visit the "Campings" administration page
Then I should see a camping "Beautifull Green"
Scenario: Logged in writer sees own campings dashboard
Given I am administrator
And I have a camping "Beautifull Green"
When I visit the administration dashboard
Then I should see a panel titled "My Campings"
Then I should see camping "Beautifull Green"
Scenario: Logged in writer can update campings
Given I am administrator
And I have a camping "Beautifull Green"
When I visit the update page for "Beautifull Green"
And I update the name to "updated!"
And I visit the "Campings" administration page
Then I should see a camping "updated!"
Scenario: Logged in writer can update camping from dashboard
Given I am administrator
And I have a camping "Beautifull Green"
When I visit the administration dashboard
Then I should see the "edit"-link for "Beautifull Green"
很多這些場景的重疊,因此或許應該已經特點的自己。請注意,重疊部分大多由共享步驟覆蓋。但仍然有很多重複。
我的主要問題是:什麼時候是某個功能,什麼時候是一個場景。任何經驗法則? 是否有良好的做法,有多少場景的功能應該包含?還是我完全誤解了整個話題?
謝謝。除了你提出的所有優點(是的,這些都是建設中的功能,需要清理),我忽略了「背景」部分。這解決了我的主要問題。關於「商業目標」的部分也非常有用。我現在看到,我的特徵確實傾向於「活動」。謝謝。 – berkes
@berkes,我很高興我的回答對你有一點幫助。 「商業目標」很有用,但有時候有點難以想象。其實我停了一會兒纔想到「管理活動」的目標是什麼:-)享受! –