An example of a Test Plan
You should include tests for:
· all conditions of normal use
· fielded e
or conditions (those that are reported by the program and program continues)
· fatal e
or conditions (those that cause the program to stop)
Please keep test plans as separate documents rather than as inline code.
This is an example a test plan for Program 2 TME1. It is not necessarily complete or the only way you can lay this out. It illustrates one way to show how you will test a program, why, and the expected results.
Testing normal conditions
java SubString qwerty 2 3
resulting string is: ert
java SubString qwerty 0 1
resulting string is: q
java SubString qwerty 0 6
resulting string is: qwerty
Testing e
or conditions in the two arguments
java SubString qwerty 1 8
resulting string is: e
or - arguments out of range
java SubString qwerty XXXXXXXXXX
resulting string is: e
or - arguments out of range
java SubString qwerty 0 g
resulting string is: e
or - arguments non numeric
Testing e
or conditions with insufficient arguments
java SubString
XXXXXXXXXXinsufficient arguments
XXXXXXXXXXplease use SubString
java SubString qwerty
insufficient arguments
XXXXXXXXXXplease use SubString
java SubString qwerty 2
insufficient arguments
XXXXXXXXXXplease use SubString
If you have no input but use built in tests these should also cover all possible conditions
and indicate the purpose of the tests in the output to the console.
If you are testing a GUI program you should also include details of the tests you have done -
and why, indicating the sequence of events and maybe a screen print of the result.
Testplans_an_example.doc updates 24/03/01
package omay.tij.ch_10_interfaces.ex10;
/*Modify Music5.java by adding a Playable interface.
Move the play() declaration from Instrument to Playable. Add Playable
to the derived classes by including it in the implements list.
Change tune()so that it takes a Playable instead of an Instrument . *
import omay.tij.ch_9_polymorphism.ex6.music.Note;
interface Playable {
void play(Note n);
}
interface Instrument {
void adjust();
}
class Wind implements Instrument, Playable {
public void play(Note n) {
XXXXXXXXXXSystem.out.println(this + ".play()" + n);
}
public String toString() {
XXXXXXXXXXreturn "Wind";
}
public void adjust() {
XXXXXXXXXXSystem.out.println(this + " .adjust()");
}
}
class Percussion implements Instrument, Playable {
public void play(Note n) {
XXXXXXXXXXSystem.out.println(this + ".play()" + n);
}
public String toString() {
XXXXXXXXXXreturn "Percussion";
}
public void adjust() {
XXXXXXXXXXSystem.out.println(this + " .adjust()");
}
}
class Stringed implements Instrument, Playable {
public void play(Note n) {
XXXXXXXXXXSystem.out.println(this + ".play()" + n);
}
public String toString() {
XXXXXXXXXXreturn "Stringed";
}
public void adjust() {
XXXXXXXXXXSystem.out.println(this + ".adjust()");
}
}
class Brass extends Wind {
public String toString() {
XXXXXXXXXXreturn "Brass";
}
}
class Woodwind extends Wind {
public String toString() {
XXXXXXXXXXreturn "Woodwind";
}
}
public class Music5 {
static void tune(Playable p) {
XXXXXXXXXXp.play(Note.MIDDLE_C);
}
static void tuneAll(Playable[] e) {
XXXXXXXXXXfor (Playable p : e)
XXXXXXXXXXtune(p);
}
public static void main(String[] args) {
XXXXXXXXXXPlayable[] orchestra = {new Wind(), new Percussion(), new Stringed(),
XXXXXXXXXXnew Brass(), new Woodwind()};
XXXXXXXXXXtuneAll(orchestra);
}
}