如何在故事/特征中记录非功能性需求(NFR)?

Chr*_*now 2 bdd specifications user-stories

" 按示例规范"一书中指出,可以使用示例指定非功能性要求(通常称为NFR).

一位同事也告诉我,可以使用以下格式使用SBE故事指定非功能性要求:

Scenario: ...
   Given ...
   When ...
   Then ...
Run Code Online (Sandbox Code Playgroud)

以下是从维基百科中获取的功能和非功能性示例:

可能需要系统向用户呈现数据库中记录数量的显示.这是一项功能要求.这个数字需要的最新状态是非功能性要求.如果需要实时更新号码,系统架构师必须确保系统能够在记录数量变化的可接受的短间隔内更新显示的记录计数.

问题1:非功能性要求是否可以指定为故事?

问题2:是否应将非功能性要求指定为故事?

问题3:故事会是什么样子?

Ben*_*ith 6

我将通过一个例子给出答案.

让我们说你的团队已经实现了以下故事:

Scenario: User can log in to the website
   Given I have entered my login credentials
   When I submit these credentials
   Then I get navigated to my home screen
Run Code Online (Sandbox Code Playgroud)

回答问题1) - 可以将非功能性要求指定为故事吗?

项目利益相关者给了你一个NFR,上面写着:

对于所有网站操作,用户应该等待不超过五秒钟的响应.

您可以为此创建一个故事,如下所示:

Scenario: User can log in to the website in a timely fashion
   Given I have entered my login credentials
   When I submit these credentials
   Then I get navigated to my home screen
   And I should have to wait no longer than the maximum acceptable wait time
Run Code Online (Sandbox Code Playgroud)

请注意,我没有命令性地指定'5'秒,而是保持场景声明,而是指定"等待不超过最大可接受的等待时间".

回答问题2) - 是否应将非功能性要求指定为故事?

NFR 绝对应该被指定为故事.

创建故事将允许估计此任务的复杂性(以便团队可以确定相对于过去故事的难度),此外团队可以将故事分解为任务(可以在几小时内估算,以便您可以如果团队能够在当前的冲刺中实现这个故事,那就可以解决问题.

因此,在我的设计示例中,团队已经实现了登录代码,但他们随后将确定如何实现登录所需的时间不超过5秒的要求.您还可以允许探索这个问题的反面,即如果登录需要超过五秒钟会发生什么?例如

Scenario: User encounters a delay when logging in to the website
       Given I have entered my login credentials
       When I submit these credentials
       And I wait for over the the maximum acceptable wait time
       Then the Production team is informed
       And the problem is logged
       And I get navigated to my home screen
Run Code Online (Sandbox Code Playgroud)

最后,关于问题3) - 故事会是什么样子?

我详细讲述了故事在答案1)和2)中的样子