4. 3步
• Set Up
• Prepare an input
• Call a method
• Check an output
• Tear down
t.test_methodA=function(){
var input={some input value};
var output=A(input);
jsunit.assertEquals(output,expectValue);
}
5. A unit test is a piece of a code (usually a method)
that invokes another piece of code and checks
the correctness of some assumptions afterward.
If the assumptions turn out to be wrong, the unit
test has failed.
A “unit” is a method or function.
UT should be : Automated, trustworthy, readable,
and maintainable.