2011-12-07 2 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 

그러나 최근에 나는 그들이 나쁜 관행으로 간주하고 있기 때문에 같은
When I click on "upvote" within the "comment" 

같은 기본 단계 정의는 더 이상 사용할 수없는 오이 1.1 이후, 그것을 발견했다. 어떻게 의미가 있는지 알 수 있지만 지금은 필자의 기능을 어떻게 추상화해야하는지 잘 모르겠습니다.

예를 들어 생각해보십시오.

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 

에서 매우 구체적인이 preferrence의 문제입니다 ,하지만 난 여기에 모범 사례를 찾기 위해 경쟁하고 있습니다. 시나리오를 지정하는 가장 좋은 방법은 무엇입니까?

답변

1

더 많은 선언적 시나리오를 만드는 것이 좋지만 너무 복잡하지 않아서 UI의 어느 부분이 관련되어 있는지 분명하지 않습니다. 제 생각에 오이 팀은 첫 번째 스타일을 좌절 시키려고 노력하면서 반대편 극단적 인 상황에 너무 조금 지나치게 빠져 나갔다고 생각합니다.

나는 당신의 마지막 예를 가장 좋아한다고 생각한다 : Given은 일반적으로 매우 구체적이어야한다.

관련 문제