2

これがキュウリに関してトリッキーなものです:

Feature: Some feature

Background:
    Given I am on the root page

Scenario Outline: Relevant flash messages should appear
    When I fill in some_field with: <name>
    Then I should see the text: <relevant_flash>

    Examples:
        | name          | relevant_flash    |
        | Some name     | Some message      |

Scenario Outline: Irrelevant flash messages should not appear
    When I fill in some_field with: <name>
    Then I should not see the text: <irrelevant_flash>

    Examples:
        | name          | irrelevant_flash  |
        | Some name     | Some message      |

私は繰り返す必要が嫌いです:

 When I fill in some_field with: <name>

しかし、明らかな理由から、単にバックグラウンドに移動することはできません。それともできますか?回避策がある場合はお知らせください...

4

2 に答える 2

0

成功したメッセージと失敗したメッセージの両方を組み合わせることで、シナリオの概要をより適切に整理して重複を回避できます。

Feature: Some feature

Background:
    Given I am on the root page

Scenario Outline: Relevant flash messages should appear
    When I fill in some_field with: <name>
    Then I should see <relevant_message>

    Examples:
        | name                  | relevant_flash     |
        | Some name             | Some message       |
        | Some irrelevant name  | Irrelevant message |
        | Name for blank msg    |                    |
于 2012-12-09T19:27:39.640 に答える
0

さて、私はあなたのキュウリをこのようなもので単純化することができます:

Feature: Some feature

 Scenario Outline: Relevant flash messages should appear
    Given I am on the root page
    When I fill in some_field with: <name>
    Then I should see <message>
  Examples:
        |        name           |        message        |
        | Some name             | Relevant message      |
        | Some other name       | Irrelevant message    |
        | Some another name     | another flash message |

Background:あなたは私がそれをカバーしたので私が取り出していることに気づきScenario Outline: ます私はこのステップがあまり繰り返されることなく実行されて簡単になると思います

于 2012-12-13T20:14:00.097 に答える