开发者

Cucumber: How do I use Multiple Scenario Outlines with one Example?

开发者 https://www.devze.com 2023-04-04 06:39 出处:网络
Scenario Outline: blah blah Scenarios: col | col | dat | dat | Scenario Outline bla开发者_如何学Pythonh blah
Scenario Outline:
   blah blah

Scenarios:
 | col | col |
 | dat | dat |

Scenario Outline
  bla开发者_如何学Pythonh blah
  <use first scenarios table>

is ther a way to do this? I'd hate to have to copy a table... =\


The data you use shouldn't depend on the scenario, so it's no big deal if you copy/paste the data from one scenario to the next. I know this isn't DRY - so if you're copying the data more than a couple of times, consider using a Factory instead (see #2).

That being said, there's a couple of things you can do/questions to ask:

  1. If blah blah is implemented as a step definition, then it's assumed that you'll reuse it when needed, that's partly what it's for
  2. Your col/dat table might be able to be replaced with a Factory (via FactoryGirl). It's pretty common to use FactoryGirl as part of your testing, alongside Cucumber.
0

精彩评论

暂无评论...
验证码 换一张
取 消