The unit of code (e.g., a class) being tested -- examples may be Car, Employee, City, Student, Instructor, Course, ... (whatever your modeling domain subject is)
🚙
Model
Another name for unit
💡
Unit Test
A class that contains tests that test the unit -- generally named CarTest, EmployeeTest, etc
 
💥
Showstopper Bug
A bug that prevents a program from starting/running or stops it from functioning (program crash)
🐞
Functional Bug
A bug that causes a program to not behave (function) as expected
🐞
Defect
Another name for bug
 
✔
Unit Testing
The act of testing a unit of code -- e.g., we may have a CarTest class (unit test) that tests a Car class (unit)
🚗
Automated Testing
Applying automation to unit testing -- e.g., running a collection of tests automatically which generates a test report/output
🔥
Smoke Testing
A subset of unit testing where the focus in on catching showstopper bugs
Compare testee actual results versus expected results
Note: The software test "comparison" can be basic (print that allows a visual compare) or more sophisticated (e.g., showing "test passes", "test fails").
Note: we will use "showstopper bug" and "blocker bug" interchangeably:
By showstopper bug we mean stop the show (i.e., stop the program from running), by blocker bug, we mean block the program from running. I.e., they both mean "stop the program from running".
Showstopper bugs are the enemy of coders:
We may have the prettiest code in the world, but one showstopper bug can make our code unusable
In the software field, unusable code causes delays and headaches
In coursework, unusable code results in scores of zero -- in fact, it is better to submit code 25% done with zero showstopper bugs than code 99% done with one showstopper bug
Check and recheck that housekeeping items match what is expected -- e.g., required package/sub-directory names, class names, class headers, method headers, constructor headers
Graders and object will be using/testing our objects from "other" directories (and importing our files as needed) so we want to do similar. Otherwise, there is a good chance we'll miss bugs that they will hit (and these could be "blocker bugs").
If we put our test code in another directory (apart from our model/domain) then we will exercise/test required "imports" etc of our code.
By domain/model we mean our data structures (e.g. dynamic arrays, linked lists, trees, etc).
Testing with primitives (e.g. integers, strings, doubles) is an okay way to get started testing. But see "lessons learned" on testing with "proper objects".
class DynamicArrayTest {
test_get_usingStrings() {
let nm1 = 'Asha';
let nm2 = 'Kofi';
let dynamic = DynamicArray.newEmpty();
dynamic.add(nm1);
dynamic.add(nm2);
var result, expected;
result = dynamic.get(0);
expected = nm1;
this.show(result.toString());
this.show(expected.toString());
result = dynamic.get(1);
expected = nm2;
this.show(result.toString());
this.show(expected.toString());
//we could also test "first" and "last" the same way
}
//...
}