testing - BDD 特性和场景

标签 testing bdd computation-theory

我目前正在研究BDD,但我有一个不同的疑问,你能告诉我以下是否正确:

  • 1) Feature = 意思是“问题”,不是吗?
  • 2) 场景 = 解决功能的方式(行为)

我发现很难找到“given when then”这样的句子。 例如在这个问题中:

作为学生

如果我有 2 个数字,我想/我想计算矩形的周长 或者圆圈区域,如果我有的话

所以我不会在计算上出错

我把场景写下来了,对吗?

给定 1 个数字

或 2 个数

当我有 1 个正数时

或2个正数

然后计算面积

或周边

最佳答案

关于术语:

1) 功能不是“问题”。它宁愿是一个解决方案。 在软件编程中,功能是您的程序为解决问题所做的事情。 一个功能可以是计算矩形面积的能力。

2) 场景是对功能使用的描述。就像一个例子。 类似于测试用例,但通常采用更易于阅读的形式。

3) 故事(在敏捷术语中,BDD 代表)是描述需求/问题的一种方式。 您的问题(“作为学生……”)以故事的形式呈现。 这个故事将导致您软件中的一项新功能。 此新功能将通过场景进行测试。

关于你的场景。
你的不正确。
没有办法知道如果你有 1 nb 你应该计算一个面积。
你应该有几个场景,比如

Given I send the number 2 
When I launch the computation
Then I get the result 12,56

Given I send the number 2 and 3
When I launch the computation
Then I get the result 10

Given I send the number -4
When I launch the computation
Then I get the result error

Given I send the number 1  3  7
When I launch the computation
Then I get the result error

关于testing - BDD 特性和场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17347081/

相关文章:

php - 有哪些框架/工具/技术可以帮助从 PHP 运行 javascript?

regex - 将调节表达式转换为 DFA

algorithm - 在计算 bool 可满足性时包含隐式约束是否有益?

algorithm - 算法思维指导(四次方程)

java - java 中的 json 响应验证(断言)

python - 在 pytest 中参数化并运行单个测试

angularjs - Cucumber-java 与 Cucumber.js

ruby - 如何使用 Cucumber/Capybara 从 txt/xls 文件导入数据?

spring - 使用 Autowiring 的 spring 服务测试自定义验证器

ruby - Rspec:访问 Klass.any_instance.stub block 内的实例