簡體   English   中英

從Cucumber BDD示例部分運行選擇性測試

[英]Running selective tests from Cucumber BDD Example Section

有沒有辦法從Cucumber BDD示例部分運行選擇性測試而無需注釋行?

例如,從下面的示例中,我想運行第二行測試而不注釋第一行和第三行。

Scenario Outline: Test Scenario
        Given logged into the test application  using <username> and <password>
        When user is navigated to home screen
        Then user should be able to find home menus

    Examples:
    | username | password |
    | test1    | pwd1     |
    | test2    | pwd2     |
    | test3    | pwd3     |

我正在使用C#-SpecFlow,可以使用“測試資源管理器”窗口來實現此目的。 使用SpecFlow和MS Visual Studio Test Explorer,用戶將能夠加載所有測試並輕松運行單個/選擇性測試。 因此也想在Cucumber Java中找到類似的選項。 請幫忙。

考慮將示例表分成兩部分,並在其上使用標簽。 然后在跑步者類別的cucumberoptions中使用所需標簽運行測試,以進行相應過濾。 如果省略標簽選項,則將運行所有測試。

    Scenario Outline: Test Scenario
        Given logged into the test application  using <username> and <password>
        When user is navigated to home screen
        Then user should be able to find home menus

    @RunSecond
    Examples:
    | username | password |
    | test2    | pwd2     |

    @RunOthers
    Examples:
    | username | password |
    | test1    | pwd1     |
    | test3    | pwd3     |

我認為在ruby cuke中,您可以通過告訴cukes示例的行號來運行test2。 因此,假設該場景稱為foo,而您的test2示例所在的行是第25行,

cucumber features/foo.feature:25

會按照您的要求做。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM