2013-06-27 57 views
0

我正在currenty研究BDD,但我有不同的疑問,你可以告訴我,如果下面的正確與否:BDD功能及場景

  • 1)功能=它的意思是「問題」 ISN」它呢?
  • 2)方案=的方式(在beahaviour)來解決特徵

我發現很難找到「給予時則」的句子。 在這個問題上,例如:

作爲一名學生

我想/我想計算矩形周邊,如果我有2個號 或者圓區域,如果我有一個

所以我不會犯錯的計算

我寫下這個場景,是否正確?

鑑於1號

或者2號

當我有1張正數

或者2的正數

然後計算面積

或者周長

回答

2

關於術語:

1)功能不是一個 「問題」。它寧可成爲解決方案。 在軟件編程中,某個功能是您的程序用來解決問題的功能。 一個功能可能是計算矩形區域的能力。

2)場景描述了你的特性的用法。就像一個例子。 就像一個測試用例,但通常以更易於理解的形式。 3)一個故事(在敏捷術語中,BDD代表)是描述需求/問題的一種方式。 您的問題(「作爲學生......」)以故事形式呈現。 這個故事將導致你的軟件的一個新功能。 這個新功能將通過場景進行測試。

關於您的場景。
你的錯誤。
沒有辦法知道,如果你有1個NB,你應該計算一個區域。
你應該有幾種情況,如

Given I send the number 2 
When I launch the computation 
Then I get the result 12,56 

Given I send the number 2 and 3 
When I launch the computation 
Then I get the result 10 

Given I send the number -4 
When I launch the computation 
Then I get the result error 

Given I send the number 1 3 7 
When I launch the computation 
Then I get the result error