【发布时间】:2014-10-21 23:29:56
【问题描述】:
我第一次尝试将 bdd 实施到一个项目中,并且对针对受众使用的语言有几个问题。
我已经看到了很多示例,其中该语言旨在被最终用户等理解。但是,如果您正在编写一个即将被使用的 api(带有 odata 支持的 rest 样式 web-api)呢?由其他开发商?可以更具体一些,还是应该尽量保持简单?
其次,如果你在一般意义上描述它,你是否必须在中指定值,例如:
Scenario: product is defined for the first time
Given product code abcdefg does not already exist
When product definition with code abcdefg is uploaded
Then product is created
And user receives status 201 created with url 'blah'
但是可以将其抽象为更一般的情况吗?例如
Scenario: product is defined for the first time
Given product code does not already exist
When product definition is uploaded
then product is created
And user receives status 201 and creation url
谢谢
更新
感谢 sam 和 AlSki,我们决定将规范分为 3 种不同类型:
User: End-User facing, most declarative style concerning UI
Dev: More imperative and detailed, concerning data only interactions
System: Most imperative and detailed - concerning our internal stuff
现在正在创建包含多个示例的场景大纲,这似乎可以很好地测试我们所有的边缘案例。
我还删除了外部开发人员无法观察到的结果(“产品已创建”等),并认为我们现在都更好地理解了这一点。
【问题讨论】: