Thursday, December 16, 2010

Program 12 - Program Test Data, Debugging and Termination: Program Test Data

For this project I will be discussing Program Test Data, and how it relates to the following languages: C++, C#, and Java.

To ensure that a program is as solid as possible, programmers must attempt to address any and all possible errors that can occur within their program. Some of these errors may produce incorrect results while others can crash a program entirely. To detect and correct bugs, programmers must use test data. Test data will be a range of input values ran through the program to determine if it creates the "typical" expected output. If it doesn't, then there is an error.

Limits Testing (also referenced as Range Testing) is a technique that is used to check the extreme conditions in which errors like to hide. These conditions are known as Boundary Conditions. To test the limits of a program, there must be input values that run at or near the boundaries of the value range. This usually begins with the lowest value of 0.

Data type testing is a technique that can be used to locate bugs within a program based on the ranges of different data types. When creating program test data, one thing a programmer can do is run the entire range of values for a data type. Depending on the data type, this may be done sparingly (especially if you consider how wide the range may be for some types.

In C++, the different data types have the following (unsigned) ranges:

Name

Size

Range

char

1byte

0 – 255

short int

2bytes

0 – 65535

int

4bytes

0 – 4294967295

long int

4bytes

0 – 4294967295

bool

1byte

True or False

float

4bytes

~7 digits

double

8bytes

~15 digits

long double

8bytes

~15 digits


 

Both Java and C# share a similar list of data types with C++.

By creating test data that covers as much of these ranges as possible, you will be able to find bugs that would otherwise go undetected until a user stumbles over one of them.

Logic Testing (also known as white-box testing) is testing method used to test the internal workings of an application. This is opposed to black-box testing, which focuses on functionality.

In logic testing, the programmer must develop a series of test cases. The programmer then selects inputs (with known outcomes) to test each path of code for logical accuracy. If the output produced from the test is correct, that path is working. If the output is incorrect, it means that there is faulty logic within that path or branch of code.

Logic testing is a valuable technique in finding many errors within the code. That is true, only if the inputs are vast enough to truly test every path.

No comments:

Post a Comment