2011-12-07 5 views
3

約1年前にキュウリを使用していたので、私はこのようにシナリオを書くことに慣れました。キュウリのシナリオに特定のUIステップを含める必要がありますか?

Scenario: user tries to vote on a comment 
    Given I have a post 
    And I have a comment on that post 
    And I am logged in as a different user 
    And I am on the post page 
    When I click on "upvote" within the "comment" 
    Then the comment score should raise 
    And the comment author should get points 

は、しかし、最近私が発見し、彼らは悪い習慣と考えられているので、キュウリ1.1以降、このよう

When I click on "upvote" within the "comment" 

などの基本的なステップの定義は、もはや利用できないこと。私はそれが意味をなさない方法を見ることができますが、私は今どのように抽象的な私の機能を書く必要があるか分かりません。

例を考えてみましょう。

When I upvote on a comment 
Then the comment should get points 

以下抽象

Given I have a post with a comment 
And I'm not the author 
When I upvote on the comment 
Then the comment author should get points 

またはそれ以下抽象

Given I have a post with a comment 
And I'm not the author 
When I upvote on the comment 
Then the comment score should increase 
And the comment author should get 1 point 

またはGiven一部私が知っている

Given I have a post with a comment 
And I'm not the author 
And I am on the page for that post 
When I upvote on the comment 
Then the comment score should increase 
And the comment author should get 1 point 

で非常に具体的には、これは、一般設定の問題ですしかし、私はtですここでベストプラクティスを模索しています。シナリオを指定する最良の方法はどれですか?

答えて

1

私はもっと宣言的なシナリオを好むが、それほど多くはないので、UIのどの部分が関与しているのか明確ではない。私はキュウリのチームが、最初のスタイルを落胆させようとしているにもかかわらず、反対の極端には少し離れすぎていると思います。

私はあなたの最後の例が一番好きだと思います:Givenは、一般的にかなり具体的にすべきです。

関連する問題