次のコードの実行に対する GWT アプローチを使用して BDD の練習を始めたところですが、2 番目のテストを実行できないことに気付きました。
私のGWTは次のようになります
Given there exists an open query
When the user replies to the query
Then it should save the reply if the reply is not blank
次に、ユーザーに通知し、空白の場合は返信を保存しないでください
だから私はそれをそのようにコーディングしました
public class when_user_replies_to_the_query : OpenQuery
{
Because
{
query.Reply(data);
}
ThenIt should_save_the_reply_to_the_database_if_there_is_a_reply
ThenIt should_notify_the_user_if_there_is_no_text_in_the_reply_and_not_save_to_database
}
public class Query
{
void Reply(string data)
{
//do something
}
}
しかし、最初のケースではデータに何かが含まれている必要があり、2 番目のケースではデータが空の文字列である必要があるため、2 番目のケースは実行できないことに気付きました。
これは、GWTを次のようなものに分割する必要があることを意味しますか?
Given the reply is blank
When the user replies to the query
Then it should notify the user ......
これが事実である場合、私はリターンのために大量のnullケースのシナリオを書いているでしょう
values being null. Such as
Given the database is null
When retrieving queries
Should reply with error message
When saving queries
Should save to file and reply with error message
When // basically doing anything
Should //give appropriate response
これは、BDD仕様をどのように書くべきですか? そして、私は適切なフォーラム O_O にいますか?