In a prior post, I described the test values that the JUnitDoclet utility uses for testing various data types. Now, I would like to describe the values I use for test string input. Note that some of these items do not make sense based on the type of testing that is being done (unit testing vs. gui testing).

I am also excluding those values that I use to specifically test for cross-site scripting (xss) or sql injection vulnerabilities. That will be a subject for another post.

Basic Tests:

null  
“” (empty string)
” “ (single space character)
“a” (single alpha character)
“abc123” (nominal alphanumeric)

For more extensive text manipulation, I might use the following values:

“lowercase” If case is going to be manipulated
“UPPERCASE” If case is going to be manipulated
“MiXedCase” If case is going to be manipulated
” Leading Spaces” See if leading whitespace impacts functionality
“\tLeading Tab” See if leading whitespace impacts functionality
“Trailing Spaces “ See if trailing whitespace impacts functionality
“Trailing Tab\t” See if trailing whitespace impacts functionality
“Embedded Spaces” See if “extra” whitespace impacts functionality
“Embedded\t Tab” See if tab in middle of string impacts functionality

Obviously, there is the possibility that length or format may matter:

Shortest possible string
If shortest possible string > 1, string with length 1 less than shortest possible string
Longest possible string
String with lenght 1 more than longest possible string
Match format mask
Not match format mask, first character
Not match format mask, last character
Not match format mask, middle character
Not match format mask, strip out “separator” characters (-, /, etc.)

HTML Character Entities

< which may be encoded as "& lt;"
> which may be encoded as “& gt;”
& which may be encoded as “& amp;”
” which may be encoded as “& quot;”

For a full listing of these encoding, see Character entity references in HTML 4.

Low order, High order ascii characters

Non-printable, low order. ASCII codes 0 – 32 (decimal)
Printable. ASCII codes 32-126
“Delete” ASCII code 127
Extended ASCII (printable and non-printable). ASCII codes 128-255