April 10, 2006

General Input Tests for an Integer Field with Negative Numbers



Here are some routine tests to try for a simple integer field, which permits negative values.

To use these values, you should first know the Minimum and Maximum values required for this field, and the number of characters in each.

Then decide which of the following are relevant for your input field and use them.

If you are using an automated test tool, these values can easily be used exhaustively, or randomly, by a test script:
  • Nothing
  • Empty field (clear any defaults)
  • More than the maximum number of digits or characters
  • 0
  • +0
  • -0 
  • Any valid positive value
  • Any valid negative value
  • Minimum - 1
  • Minimum
  • Maximum
  • Maximum + 1
  • Much less than the Minimum
  • Much more than the Maximum
  • Minimum number of digits or characters
  • Minimum - 1 number of digits or characters
  • Maximum number of digits or characters
  • Maximum + 1 number of digits or characters
  • Much more than the Maximum number of digits or characters
  • Nondigits, expecially / (ASCII character 47) and : (ASCII character 58)
  • Wrong data type (e.g., decimal into integer)
  • Expressions
  • A single leading space
  • Many leading spaces
  • A single trailing space
  • Many trailing spaces
  • Lead and trailing spaces
  • Leading 0
  • Many leading zeros
  • Leading + sign
  • Many leading + signs
  • Leading - sign
  • Many leading - signs
  • Nonprinting character (e.g., Ctrl+char)
  • Operating system filename reserved characters (e.g., "*.:")
  • Language-specific reserved characters
  • Upper ASCII (128-254) (a.k.a. ANSI) characters
  • ASCII 255 (often interpreted as end of file)
  • Uppercase characters
  • Lowercase characters
  • Modifiers (e.g., Ctrl, Alt, Shift-Ctrl, and so on)
  • Function key (F2, F3, F5, and so on)
  • -127
  • -128
  • -126
  • 126
  • 127
  • 128
  • 254
  • 255 (1-byte, tinyint) 
  • 256
  • -256
  • -257
  • -255 
  • 32766
  • 32767 (2-byte, smallint) 
  • 32768
  • -32768
  • -32769
  • -32767 
  • 65534
  • 65535 (2-byte unsigned, smallint) 
  • 65536
  • 2147483646
  • 2147483647 (4 byte, int) 
  • 2147483648
  • - 2147483648
  • - 2147483649
  • - 2147483647 
  • 4294967294
  • 4294967295 (4-byte unsigned, int) 
  • 4294967296
  • 9223372036854775806
  • 9223372036854775807 (8 byte, bigint) 
  • 9223372036854775808
  • -9223372036854775808
  • -9223372036854775809
  • -9223372036854775807
  • 18446744073709551614
  • 18446744073709551615 (8 byte unsigned, bigint) 
  • 18446744073709551616
(adapted from "Lessons Learned in Software Testing", and other sources)