0% found this document useful (0 votes)
45 views3 pages

Stamford University Assignment

The document provides checklists for testing a Java project covering data reference errors, data declaration errors, computation errors, comparison errors, control-flow errors, interface errors, input/output errors, and other checks. The checklists include items to test such as checking for uninitialized variables, variable type mismatches, loop termination, file handling, and compatibility with other systems.

Uploaded by

Dairo Samuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views3 pages

Stamford University Assignment

The document provides checklists for testing a Java project covering data reference errors, data declaration errors, computation errors, comparison errors, control-flow errors, interface errors, input/output errors, and other checks. The checklists include items to test such as checking for uninitialized variables, variable type mismatches, loop termination, file handling, and compatibility with other systems.

Uploaded by

Dairo Samuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

STAMFORD UNIVERSITY ASSIGNMENT.

Question 1: Assume that you are invited to test a project written in modern Java programming
language (e.g., Java SE 17 (LTS)). Prepare a language-dependent checklist similar to our discussion in
Week 1 that covers the following categories. You can create new categories if you deem necessary.

• Data Reference Errors

• Data Declaration Errors

• Computation Errors

• Comparison Errors

• Control-Flow Errors

• Interface Errors

• Input/Output Errors

• Other Checks

Answer –

Data Reference Errors Checklist (language-dependent JAVA SE 17)

 Are array and string subscripts integer values, and do they always fall within the dimensions
of the array or string?
 Is there a reference to an uninitialized variable? It is just as important to look for omissions
as it is to look for errors.
 When a memory area has alias names with different attributes, does the data value in this
area have the correct attributes when accessed through one of these names? If the program
stores a floating-point value in A and then defines an integer reference variable B, an error
will most likely occur because the machine will interpret the floating-point bit representation
in the memory area as an integer.
 Are there any "off by one" errors in indexing operations or array subscript references?
 Is a data structure defined the same way if it is referenced in multiple functions or
subroutines?

Data Declaration Error Checklist

 Do descriptive variable and constant names follow naming conventions? i.e. Is the correct
length, type, and storage class assigned to all variables? Should a variable, for example, be
declared as just a string rather than an array of characters?
 Are there variables with names that are confusingly similar? i.e. Are there any variables with
names that are similar? This isn't necessarily a bug, but it could indicate that the names were
mixed up with those from elsewhere in the program.
 Has each variable been properly initialized? i.e. Is a variable properly initialized and
consistent with its type if it is declared and initialized at the same time?
 Are there any variables declared that are never or only once referenced?
 Is it possible to make any non-local variables local?
 Should there be literal constants named constants?
 Should there be any macros that should be constants?
 Are there any variables that should be treated as constants?
 Is each variable explicitly declared within its own module? If not, is it understood that the
variable is shared with the module above it?

Computation Errors Checklist

 Is it possible to overflow or underflow in the middle of a numerical calculation?


 Is there any doubt about the order of evaluation of expressions containing multiple
operators, and is operator precedence, correct? Is it necessary to use parentheses for
clarification?
 To avoid ambiguity, are parentheses used in where required of them?
 Can the value of a variable be out of the reasonable range? For example, can the probability
result be less than 0% or more than 100%?
 Do any calculations that use variables have different data types, such as adding an integer to
a floating-point number?
 Is overflow or underflow possible during numerical calculation?
 Can a divisor/coefficient be zero?
 For integer arithmetic, does your code handle situations where precision is lost due to some
calculations, specifically division?

Comparison Error Checklist

 Are comparison operations used, correct? Is there no confusion whether to use less than or
equal to?
 Are there any Boolean expression not stated correctly? Is the Boolean calculation working as
expected? Is there little doubt in the order of evaluation?
 Are Boolean operator operands properly declared as Boolean? I.e., are integer variables
containing integer values used in Boolean calculations?
 Is there an inappropriate and unnoticed side effect of the comparison?

Control-Flow Error Checklist

 Are the most appropriate looping constructs used for each loop?
 When there are multiple outputs from a loop, is each output needed and handled correctly?
 Is it possible to exit the loop early?
 Will each loop end properly? Will the program, module, subroutine, or loop eventually
terminate? If it won`t, is that acceptable?
 Are zero-body control structures correct and marked with curly braces or comments?
 Are there any switch statement without a default case?
 Are there any missing switch case break statement not correct and that neither marked with
comments?
 Will every function be terminated? Are go-to statements also avoided?

Interface Error Checklist

 Do the number, order, type, and value of the parameters in each function call match in the
declaration of the called function?
 Do the values match in units? (e.g., Yards versus Inches)
Input/Output Error Checklist

 Before use of any file, have all the files been opened?
 Have all files been properly closed after the use of it?
 Are all error conditions checked thoroughly?
 In the text printed and displayed, are there any spelling error or grammatical one? Are all
error messages checked for accuracy, suitability, grammar, and spelling?
 In the open statement, are the attributes consistent with the use of the file?
 Do the software handle situations where an external device is disconnected, unavailable, or
full during a read or write operation?

Other Checks

 Does the software work in languages other than English? Do you want to handle extended
ASCII characters? Should I use Unicode instead of ASCII?
 Is this taken into account if the software needs to be portable to other compilers and CPUs?
Portability can be a major issue if it is not planned and tested, if desired.
 Is compatibility considered so that the software works with different amounts of available
memory, different internal hardware such as graphics and sound cards, and different
peripherals such as printers and modems?
 Does compiling a program generate a "warning" or "information" message? They usually
indicate that something suspicious is happening. Purists will argue that no warning is
acceptable.

You might also like