Specflow中的示例标记

时间:2012-04-19 04:01:26

标签: specflow

如何在Specflow中使用示例标记?在小黄瓜语法中是什么意思。任何示例或博客重定向都会有所帮助,谢谢

1 个答案:

答案 0 :(得分:4)

如何直接来自github examples

基本上,这通常使用Scenario Outline,这只是一种使用不同输入/输出数据运行相同场景的方法,而无需重新键入整个场景。通常,我将其视为Scenarios,但Examples似乎也可以。

来自示例:

以下两种情况:

Scenario: Title should be matched
    When I perform a simple search on 'Domain'
    Then the book list should exactly contain book 'Domain Driven Design'

Scenario: Space should be treated as multiple OR search
    When I perform a simple search on 'Windows Communication'
    Then the book list should exactly contain books 'Inside Windows SharePoint Services', 'Bridging the Communication Gap'

与此一个场景大纲相同

@alternative_syntax
Scenario Outline: Simple search (scenario outline syntax)
    When I perform a simple search on '<search phrase>'
    Then the book list should exactly contain books <books>

    Examples:
        |search phrase          |books                                                                  |
        |Domain                 |'Domain Driven Design'                                                 |
        |Windows Communication  |'Inside Windows SharePoint Services', 'Bridging the Communication Gap' |