Testing a software design is different from testing an electronic design. When testing a software design, don't confine your test to the tasks the software should perform. Test your software for things it should not do. Here is an example:
#include <iostream.h>
#include <math.h>
int main(int argc, char *argv[])
{
double L, C, LC, S, FR, Pi;
char a;
a = 'n';
while (a == 'n')
{
L=C=0.0;
LC = S = FR =0.0;
Pi = 314.0;
while (L == 0)
{
L = 0;
cout << "\nenter inductance: ";
cin >> L;
if (L == 0) cout << " invalid entry";
}
while (C == 0)
{
C = 0;
cout << "\nenter capacitance: ";
cin >> C;
if (C == 0) cout << " invalid entry";
}
LC = L*C;
S = sqrt(LC);
FR = 1/(2*Pi*S);
cout << "\nThe resonant frequency is: " << FR << " cycles/sec\n";
cout << "\nExit? ";
cin >> a;
}
return 0;
}
If you only tested this small program for what it should do, your test would not reveal a bug in this program. Experienced programmers would probably spot the bug quickly.
A thorough test of the program would reveal that if the user accidentally enters a letter as a value for L or C, the program does not respond correctly.
As a software engineer or software test engineer, it is important to spot flaws that occur when the user makes a mistake.
Once I worked on a control panel and everything appeared to work okay long as I operated one switch at a time. I found a flaw when I operated two switches in rapid succession. The software did not respond to the latter switch movement.
One software engineer would hand me a software package to test while instructing me to search for ways to make the software fail. That was excellent advice!
John
#include <iostream.h>
#include <math.h>
int main(int argc, char *argv[])
{
double L, C, LC, S, FR, Pi;
char a;
a = 'n';
while (a == 'n')
{
L=C=0.0;
LC = S = FR =0.0;
Pi = 314.0;
while (L == 0)
{
L = 0;
cout << "\nenter inductance: ";
cin >> L;
if (L == 0) cout << " invalid entry";
}
while (C == 0)
{
C = 0;
cout << "\nenter capacitance: ";
cin >> C;
if (C == 0) cout << " invalid entry";
}
LC = L*C;
S = sqrt(LC);
FR = 1/(2*Pi*S);
cout << "\nThe resonant frequency is: " << FR << " cycles/sec\n";
cout << "\nExit? ";
cin >> a;
}
return 0;
}
If you only tested this small program for what it should do, your test would not reveal a bug in this program. Experienced programmers would probably spot the bug quickly.
A thorough test of the program would reveal that if the user accidentally enters a letter as a value for L or C, the program does not respond correctly.
As a software engineer or software test engineer, it is important to spot flaws that occur when the user makes a mistake.
Once I worked on a control panel and everything appeared to work okay long as I operated one switch at a time. I found a flaw when I operated two switches in rapid succession. The software did not respond to the latter switch movement.
One software engineer would hand me a software package to test while instructing me to search for ways to make the software fail. That was excellent advice!
John