關於術語:
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