Top 10 Negative Test Cases

本文介绍了进行软件负面测试时应考虑的十大关键测试案例,包括单引号嵌入问题、必填项验证、字段类型测试等,确保软件在非预期使用情况下仍能保持稳定。

Negative test cases are designed to test the software in ways it was not intended to be used, and should be a part of your testing effort.  Below are the top 10 negative test cases you should consider when designing your test effort:

  1. Embedded Single Quote - Most SQL based database systems have issues when users store information that contains a single quote (e.g. John's car).  For each screen that accepts alphanumeric data entry, try entering text that contains one or more single quotes.
  2. Required Data Entry - Your functional specification should clearly indicate fields that require data entry on screens.  Test each field on the screen that has been indicated as being required to ensure it forces you to enter data in the field.
  3. Field Type Test - Your functional specification should clearly indicate fields that require specific data entry requirements (date fields, numeric fields, phone numbers, zip codes, etc).  Test each field on the screen that has been indicated as having special types to ensure it forces you to enter data in the correct format based on the field type (numeric fields should not allow alphabetic or special characters, date fields should require a valid date, etc).
  4. Field Size Test - Your functional specification should clearly indicate the number of characters you can enter into a field (for example, the first name must be 50 or less characters).  Write test cases to ensure that you can only enter the specified number of characters. Preventing the user from entering more characters than is allowed is more elegant than giving an error message after they have already entered too many characters.
  5. Numeric Bounds Test - For numeric fields, it is important to test for lower and upper bounds. For example, if you are calculating interest charged to an account, you would never have a negative interest amount applied to an account that earns interest, therefore, you should try testing it with a negative number.   Likewise, if your functional specification requires that a field be in a specific range (e.g. from 10 to 50), you should try entering 9 or 51; it should fail with a graceful message.
  6. Numeric Limits Test - Most database systems and programming languages allow numeric items to be identified as integers or long integers.  Normally, an integer has a range of -32,767 to 32,767 and long integers can range from -2,147,483,648 to 2,147,483,647.  For numeric data entry that do not have specified bounds limits, work with these limits to ensure that it does not get an numeric overflow error.
  7. Date Bounds Test - For date fields, it is important to test for lower and upper bounds. For example, if you are checking a birth date field, it is probably a good bet that the person's birth date is no older than 150 years ago.  Likewise, their birth date should not be a date in the future.
  8. Date Validity - For date fields, it is important to ensure that invalid dates are not allowed (04/31/2007 is an invalid date).  Your test cases should also check for leap years (every 4th and 400th year is a leap year).
  9. Web Session Testing - Many web applications rely on the browser session to keep track of the person logged in, settings for the application, etc.  Most screens in a web application are not designed to be launched without first logging in.   Create test cases to launch web pages within the application without first logging in.  The web application should ensure it has a valid logged in session before rendering pages within the application.
  10. Performance Changes - As you release new versions of your product, you should have a set of performance tests that you run that identify the speed of your screens (screens that list information, screens that add/update/delete data, etc).   Your test suite should include test cases that compare the prior release performance statistics to the current release.  This can aid in identifying potential performance problems that will be manifested with code changes to the current release.
Write a C program to partitions a hypergraph G = (V, E) into 2 partitions. The Assignment Write a computer program that takes a netlist represented by a weighted hypergraph and partitions it into two partitions. Each node is associated with an area value and each edge has an edge cost. Your program should minimize the total cost of the cut set, while satisfying the area constraint that the total area of partition 1 should satisfy the balance criteria as described in the class. That is, if the area sum of all the nodes is A, then the area of partition 1 should be greater than or equal to ra-tio_factor *A – amax and less than or equal to ratio_factor *A + amax, where amax is the maximum value among all cell areas. The program should prompt the user for the value of ratio_factor. Assumptions and Requirements of the Implementation 1. Your program should not have any limitation on the maximum number of nodes and the edges of the hypergraph. Each hyperedge could connect any subset of nodes in the hypergraph. 2. Each node area is a non-negative integer, and each edge cost is a non-negative floating- point value. 3. All the ids are 0-based. Namely, the id of the first element is 0, instead of 1. 4. The output of each partition should include the list of node ids, sorted in the ascending order. 5. The partition with the smaller minimum node id is listed first in the output. 6. Use balance criteria as the tiebreaker when there are multiple cell moves giving the max-imum gain, as described in the class. 7. Use the input and output formats given in the Sample Test Cases section. Sample Test Cases Test1: Please enter the number of nodes: 4 Please enter each of the 4 nodes with its id and the node area: 0 1 1 1 2 1 3 1 Please enter the number of edges: 3 Please enter each of the 3 edges with the number of connected nodes and their node ids, followed by the edge cost: 2 0 1 1 2 1 2 3 2 2 3 1 Please enter the percentage of the ratio factor: 50 The node ids of the partition 0 are 0 The node ids of the partition 1 are 1, 2, 3 The total cut cost is 1 Test2: Please enter the number of nodes: 4 Please enter each of the 4 nodes with its id and the node area: 0 1 1 4 2 2 3 1 Please enter the number of edges: 3 Please enter each of the 3 edges with the number of connected nodes and their node ids, followed by the edge cost: 3 0 1 2 5 3 0 2 3 3 3 0 1 3 4 Please enter the percentage of ratio factor: 50 The node ids of the partition 0 are 3 The node ids of the partition 1 are 0, 1, 2 The total cut cost is 7
07-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值