Junit 初学者关于BDD过程的几个问题
这些天我读了几篇关于BDD的文章,想知道它在说什么。现在我有了一个基本的了解,但仍然不清楚整个过程 以下是我认为在BDD过程中应该做的事情:Junit 初学者关于BDD过程的几个问题,junit,cucumber,bdd,scenarios,Junit,Cucumber,Bdd,Scenarios,这些天我读了几篇关于BDD的文章,想知道它在说什么。现在我有了一个基本的了解,但仍然不清楚整个过程 以下是我认为在BDD过程中应该做的事情: 所有涉众(BA、客户、开发人员、QA)坐在一起讨论需求,并在故事卡上写下商定的功能。这里我以“用户注册”功能为例: As a user, I want to register on the system, so that I can use its services 以Given/When/Then格式创建几个场景,以下是其中之一: Scenario:
As a user,
I want to register on the system,
so that I can use its services
Given/When/Then
格式创建几个场景,以下是其中之一:
Scenario: user successfully register
Given an register page
And an un-registered user
When the user fills username "Jeff" and password "123456"
And click on "Register"
Then the user can see a "Success" message
And the user "Jeff" is created in the system
BA/Customer/QA
,我认为他们并不真正关心实现,与其他开发人员讨论是一个好主意吗
假设在我与其他开发人员讨论之后,我们同意将它分成几个小部分。我们可以像刚刚使用cucumber jvm那样使用scenario/Given/When/Then
格式将这些小部分作为“scenario”吗,或者我们可以像在TDD中通常使用的那样使用JUnit吗
1. If choose "cucumber-jvm", it seems a little heavy for small part
2. If choose JUnit, we need to involve more than one testing framework in a project
3. Is it the best if there is a single testing framework to do both things (not sure if there is)
假设我选择选项2
,将JUnit用于小任务
以下是我在做出这一决定后将要做的事情:
场景:用户成功注册了(失败),现在就把它放在那里。对吧?
场景:用户成功注册。完成它,并确保它最终变成绿色
Given Jeff isn't registered with the site
When he registers with the username "Jeff" and password "123456"
Then his account creation should be confirmed
And he should be invited to log in for the first time.
在这里查看“声明式与命令式”以了解更多信息看起来,就流程的其余部分而言,您几乎走在了正确的轨道上。您可能会发现我的个人资料中的其他BDD答案对您也有帮助。祝贺你,祝你好运 我认为在学习BDD的技巧时,先注册/登录是一件非常好的事情。几乎每个人都知道你为什么要登录一个系统,每个人都知道系统必须知道你是谁才能这样做,所以你必须先注册 完成这个简单的任务可以让您专注于BDD的一个较小的子集。通过缩小您的关注范围,您可以提高质量,同时
Given Jeff isn't registered with the site
When he registers with the username "Jeff" and password "123456"
Then his account creation should be confirmed
And he should be invited to log in for the first time.
Feature: Registration
A pre-requistite for signing in, see sign_in.feature
Scenario: Register
Given I am a new user
When I register
Then I should be registered
Feature: Sign in
Dependant on registration ...
I want to sign in so I can have personalised content and ...
Scenario: Sign in
Given I am registered
When I sign in
Then I should be signed in
Scenario: Sign in with bad password
Given I am registered
When I sign in with a bad password
Then I should not be signed in
And I should be told ...