典型的测试错误有哪些?(12)

发表于:2014-12-08来源:uml.org.cn作者:不详点击数: 标签:典型测试错误
What is a test design? 什么是测试设计? A test design should contain a description of the setup (including machine configuration for a configuration test), inputs given to the product, and a des

  What is a test design?

  什么是测试设计?

  A test design should contain a description of the setup (including machine configuration for a configuration test), inputs given to the product, and a description of expected results. One common mistake is being too specific about test inputs and procedures.

  测试设计应当包含设置描述(包括配置测试的机器配置),对产品的输入和预期结果的描述。一个常见错误是对测试输入和过程过于注重细节。

  Let's assume manual test implementation for the moment. A related argument for automated tests will be discussed in the next section. Suppose you're testing a banking application. Here are two possible test designs:

  让我们先假设一个手工测试实施。相关的自动化测试将在下一节讨论。假设你在测试银行应用程序。这里有两个可能的测试设计:

  Design 1

  设计1

  Setup: initialize the balance in account 12 with $100.

  设置:将帐户12的余额初始化为$100。

  Procedure:

  过程:

  Start the program.

  Type 12 in the Account window.

  Press OK.

  Click on the 'Withdraw' toolbar button.

  In the withdraw popup dialog, click on the 'all' button.

  Press OK.

  Expect to see a confirmation popup that says "You are about to withdraw all the money from this account. Continue?"

  Press OK.

  Expect to see a 0 balance in the account window.

  Separately query the database to check that the zero balance has been posted.

  Exit the program with File->Exit.

  启动程序。

  在帐户窗口中输入12。

  按“确定”按钮。

  点击“取款”工具条按钮。

  在弹出的取款对话框中,点击“所有”按钮。

  按“确定”按钮。

  预期会看到一个确认消息:“您将从此帐户中取出所有的钱,是否继续?”

  按“确定”按钮。

  在帐户窗口中预期会看到余额为0。

  单独查询数据库,检查余额为0。

  通过“文件->退出” 退出程序。

  Design 2

  设计2

  Setup: initialize the balance with a positive value.

  设置:将帐户余额初始化为一个正值。

  Procedure:

  过程:

  Start the program on that account.

  Withdraw all the money from the account using the 'all' button.

  It's an error if the transaction happens without a confirmation popup.

  Immediately thereafter:

  - Expect a $0 balance to be displayed.

  - Independently query the database to check that the zero balance has been posted.

  启动该帐户的程序。

  用“所有”按钮从帐户中取出所有的钱。

  如果在事务发生时没有弹出确认消息,则是一个错误。

  其后立即:

  - 预期余额会显示$0。

  - 单独查询数据库,检查余额为0。

  The first design style has these advantages:

  第一种设计风格有以下优点:

  · The test will always be run the same way. You are more likely to be able to reproduce the bug. So will the programmer.

  · 测试总是以相同方式运行。重现错误的可能性更大。程序员也一样。

  · It details all the important expected results to check. Imprecise expected results make failures harder to notice. For example, a tester using the second style would find it easier to overlook a spelling error in the confirmation popup, or even that it was the wrong popup.

  · 它将所有要检查的预期结果的细节都描述出来。不精确的预期结果使得错误更难注意到。例如,使用第二种风格的测试员将会发现更容易忽略确认对话框中的错误拼写,甚至是错误的对话框。

  · Unlike the second style, you always know exactly what you've tested. In the second style, you couldn't be sure that you'd ever gotten to the Withdraw dialog via the toolbar. Maybe the menu was always used. Maybe the toolbar button doesn't work at all!

  · 不像第二种测试风格,你总是能明确地知道你在测试什么。在第二种风格中,你不能确定可以通过工具条得到“取款”对话框。也许总是使用菜单。也许工具条根本不起作用!

原文转自:http://www.uml.org.cn/Test/200709289.asp