Part 1 Testing (for both homeless records
and shelter records)
Case 1 to 6: Test for program
Case 1: User does not input a file name as
an argument. This cause an error
message, and program terminate. Output: Usage: “program name” file.
Case 2: User input a file name as an
argument, but the file does not exist and user chooses the exit option. This creates a file with given name with no
record in it (empty file). If the file exists,
and user chooses the exit option, the file will be remain
unchanged. The program exit and
terminate in both cases.
Case 3: User input a file name as an
argument, but the file does not exist and user chooses to enter a record. This creates a file with given name. User enters one record, which doesn’t violate
any of the rules and boundaries of each field.
The record entered is saved in the file created with each field having a
fixed length and a delimiter between each field. User chooses the exit option. The program exit and terminate. (See homeone.dat
for homeless record, shelterone.dat for shelter
record)
Case 4: User input a file name as an
argument and the file entered exist.
User chooses to enter a record.
User enters one record, which doesn’t violate any of the rules and boundaries
of each field. The record entered is
saved at the end of file entered (behind the existing data) with each field
having a fixed length and a delimiter between each field. User chooses the exit option. The program exit and terminate. (See homeone.dat
for homeless record, shelterone.dat for shelter
record)
Case 5: User input a file name as an
argument, but the file does not exist.
This will create a new file called the name entered by user. User chooses to enter five records, all
records entered doesn’t violate any of the rules and boundaries of each
field. The record entered is saved in
the file that is created with each field having a fixed length and a delimiter
between each field. User chooses the exit
option. The program exit and
terminate. (See homefive.dat
for homeless record, shelterfive.dat for shelter
record)
Case 6: User input a file name as an
argument and the file entered exist.
User chooses to enter five records, which doesn’t violate any of the
rules and boundaries of each field. The
record entered is saved at the end of file entered (behind the existing data)
with each field having a fixed length and a delimiter between each field. User chooses the exit option. The program exit and terminate.
(See homefive.dat
for homeless record, shelterfive.dat for shelter record)
Case 7 - : Test for input
Case 7: Numerical Input
Homeless Record: SIN (9 integers) and
number of child (2 integers)
Shelters Record: ID (9 integers) and
number of vacancies (4 integers)
Case a: User input a number with length
not equal to the field’s requirement. An
error message will output to screen and ask user to re-enter a number that is
proper in length for that field. User
will keep asking to input a number until the length of input is valid (see
above for proper length).
Case b: User input a negative number. An error message will output to screen and
ask user to re-enter a non-negative number.
User will keep asking to input a number until number entered is non-negative.
Case c: User input a non-negative number
in proper length. Number will be
accepted and proceed to next input.
Case d: User input a non-numerical
input. An error message will output to
screen and ask user to re-enter a numerical input. User will keep asking to input a number until
the input is numerical.
Case e: User entered ‘00’ or ‘0000’ as an
input. Number will be accepted and
proceed to next input. This is the only
forms of the value zero that will take as a valid input. Other forms like ‘0’, ‘000’, ‘00000’ and etc
will consider as an invalid input.
Case 8: Text Input (max 30 characters for
all kinds of inputs)
Homeless Record: last name, first name,
city/town
Shelters Record: name of shelter and
city/town
Case a: User input a string with length
greater than 30 characters in length. An
error message will output to screen and ask user to re-enter a string that is
less than or equal to 30 characters in length.
User will keep asking to input a string until input is less than or
equal to 30 characters in length.
Case b: User input a string with length
less than or equal to 30 characters in length.
The input contains ‘ | ’ (delimiter). An error message will output to screen and
ask user to re-enter a string without ‘ | ’ in
it. User will keep asking to input a
string until input does not contain ‘ | ‘ in it.
Case c: User input a string without a ‘ | ‘ character and is less than or equal to 30 characters
in length. The string will be accepted
and proceed to next input.
Case 9: Choices Input
Homeless Record: gender, marital status
and province
Shelters Record: type of shelter and
province
Case a: User input a choice that is not in
the choice list. An error message will
output to screen and ask user to re-enter a choice that is in the choice
list. User will keep asking to input a
choice until choice entered is in the list.
Case b: User input a choose that in the
list but in lower case letters. Input
will be converted to upper case letters and choice will be accepted and proceed
to next input.
Case c: User input a choose that in the
list but in upper case letters. Choice
will be accepted and proceed to next input.
Part 2 Testing
(for both homeless records and shelters records)
Case 1: User entered a file name that does
not exist. An error message will output
to screen which tell user that the file does not exist. Then the program terminate.
Case 2: User entered a file name that
exists. The file is empty (no
record). Nothing is output to screen and
the program terminate.
Case 3: User entered a file name that
exists. The file contains only one
record. That record will be output to
screen with all short forms convert back to long form. Program terminates after the record is
outputted.
Case 4: User entered a file name that
exists. The file contains three
records. All three records will be
output to screen at the same time with all short forms convert back to long
form and each field per line. Program
terminates after the three records are outputted.
Case 5: User entered a file name that
exists. The file contains five
records. All five records will be output
to screen at the same time with all short forms convert back to long form and
each field per line. Program terminates
after the five records are outputted.
Case 5: User entered a file name that
exists. The file contains seven
records. The first five records will
outputted to screen in a similar form as above.
User is asked to press enter to display the next five records or any
other input to exit the program. In this
case, the remaining two records will output to screen when enter is press by
user. If other input were pressed, the
program terminates without displaying the remaining two records. Program terminates after all seven records
are outputted.
Case 6: User entered a file name that
exists. The file contains more than five
records. The first five records will
outputted to screen in a similar form as above.
User is asked to press enter to display the next five records or press
any input to exit the program. The next
five records will be display when user pressed enter. If any other input were pressed, the program
terminates without displaying the remaining records. User will keep ask to press enter to display
next five records or any other input to exit the program. Program terminates when all records in file
are outputted.