ds342222 2017-12-08 16:54
浏览 89

可以重用godog方案吗?

I have a defined scenario in godog:

User starts a workspace with stack
    Given Minishift has state "Running"
    When user triggers workspace creation for stack
    Then workspace should be starting
    When user looks at the workspace status
    Then the workspace status should be running and creation successful

and I was wondering if it was possible to reuse this scenario for multiple stacks? Ideally, I would reuse this scenario for every stack and if that stack failed then I would fail that scenario but not all the tests. Each stack is independent of the others. I'm not sure if this is possible or if I have to manually define each stack as a scenario and do it that way.

  • 写回答

2条回答 默认 最新

  • dsgwii4867 2017-12-21 13:33
    关注

    Scenario Outline with Examples (as documented here for behat, but also implemented in Godog) does what you describe:

    Scenario Outline: User starts a workspace with stack
        Given "<stack>" has state "Running"
        When user triggers workspace creation for stack
        Then workspace should be starting
        When user looks at the workspace status
        Then the workspace status should be running and creation successful
    Examples:
        | stack     |
        | Minishift |
        | Redshift  |
        | Lateshift |
    

    Your scenario will be called three times, with the parameters [Minishift, Running]; [Redshift, Running] and finally [Lateshift, Running] being passed to the first step.

    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求苍穹外卖环境配置
  • ¥15 代码在keil5里变成了这样怎么办啊,文件图像也变了,
  • ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
  • ¥15 clousx6整点报时指令怎么写
  • ¥30 远程帮我安装软件及库文件
  • ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
  • ¥20 深信服vpn-2050这台设备如何配置才能成功联网?
  • ¥15 Arduino的wifi连接,如何关闭低功耗模式?
  • ¥15 Android studio 无法定位adb是什么问题?
  • ¥15 C#连接不上服务器,