Testing 自动验收测试是否重要,以测试字段是否保存到数据库?

Testing 自动验收测试是否重要,以测试字段是否保存到数据库?,testing,automated-tests,specflow,user-acceptance-testing,Testing,Automated Tests,Specflow,User Acceptance Testing,我使用SpecFlow作为自动验收测试框架,使用NHibernate作为持久性。我正在处理的intranet应用程序的许多UI页面都是基本数据输入页面。显然,向其中一个页面添加一个字段被认为是一个“功能”,但我想不出除此之外该功能的任何场景 Given that I enter data X for field Y on Record 1 And I click Save When I edit Record 1 Then I should data X for field Y 像这样自

我使用SpecFlow作为自动验收测试框架,使用NHibernate作为持久性。我正在处理的intranet应用程序的许多UI页面都是基本数据输入页面。显然,向其中一个页面添加一个字段被认为是一个“功能”,但我想不出除此之外该功能的任何场景

Given that I enter data X for field Y on Record 1 
And I click Save 
When I edit Record 1 
Then I should data X for field Y

像这样自动化测试有多普遍和必要?此外,我使用的是NHibernate,所以我并不是在处理自己的数据持久层。一旦我将属性添加到映射文件中,它就很有可能不会被错误删除。考虑到这一点,“一次性”手动测试还不够吗?我很想听听你在这方面的建议和经验。

我通常会有类似“成功创建…”的场景来测试成功案例(你填写所有必填字段,所有输入都有效,你确认,最后它真的被保存)。 我不认为您可以轻松地为单个字段定义单独的场景,因为成功创建的场景通常需要“同时”满足其他几个标准(例如,必须填写所有必需的字段)

例如:

Scenario: Successful creation of a customer
Given I am on the customer creation page
When I enter the following customer details
| Name | Address |
| Cust | My addr |
And I save the customer details
Then I have a new customer saved with the following details
| Name | Address |
| Cust | My addr |
稍后,我可以在此场景中添加其他字段(例如账单地址):

当然,可能有更多与新字段相关的场景(例如验证等),您必须定义或扩展这些场景


我认为如果你采用这种方法,你可以避免很多“琐碎”的场景。我可以说这是“创建客户功能”的成功案例,至少值得一次测试。

谢谢。我喜欢这个主意。我们完全站在同一页上。
Scenario: Successful creation of a customer
Given I am on the customer creation page
When I enter the following customer details
| Name | Address | Billing address |
| Cust | My addr | Bill me here    |
And I save the customer details
Then I have a new customer saved with the following details
| Name | Address | Billing address |
| Cust | My addr | Bill me here    |