??????????????????3
???????????? ???????[ 2013/8/6 13:56:54 ] ????????
????1.2Junit??????????
????JUnit---SourceForge???---IBMCommon Public License ---????:www.junit.org
????ASP??C++??c#??Effel??Delphi??Perl??PHP??Python??REBOL??Smalltalk??Visual Basic??
????xUnit?????:1.???????д???????????????????????????????2.?????????????????????????????????е????????μ?????
????Junit????:
??????????????????????????
?????????????????????????????????????????????????????
?????????????????????????У?JUnit??Ant??????????????
????Junit??????????????????ж??ο???
?????????????JUnit???????
????Junit?????д?????:
????????????д?????????????????????????????????д
???????????????????
???????????ü??е????????д???????
????Junit??????:
????????????????ж?????????????????????Boolean?
?????????????豸??ù?????????????????
???????????????????????????
?????????ν????????????????
????JUnit????7??????????????junit.framework??junit.runner??Framework??????????????????????Runner???????????????
????JUnit??4?????????:TestSuite??TestCase??TestResult??TestRunner???????????Framework?????????????????????????????????????????????????????????????????ν???
????TestResult:???????TestCase????е????????????????Failure?????????Error???????????????????TestListener(?y????TestRunner????)???д???
????TestRunner:?????????????????????????????????и???????????????????????????????????
????TestSuite:???????????????е?TestCase
????TestCase:??????????????е???????????????????г???????????????????.
???????????????:Test??TestListener
????Test:????????????:run()??countTestCases()-->????????????????????
????TestListener:addError()??addFailure()??startTest()??endTest()-->????????????????????????????????????????????????
????Junit??????:TestCase(??junit.swingui.TestRunner??????)??TestSuite(?????)??TestResult(??????????????)??TestListener(?????????)??TestFailure(???????)??AssertionFailedError.
????Junit??Eclipse????????????ο???JUnit in Action??
????Junit???????д???:java junit.textui.TestRunner xxx
????1.3JUnit???
????1.3.1. ????????:
????Eclipse??JUnit??Ant
????1.3.2. ??????????????????ж????:
class Triangle{
private double a?? b?? c;
public Triangle ( double a?? double b?? double c ){
this.a = a;
this.b = b;
this.c = c;
}
/*
?????? 1 ?????????????
?????? 2 ??????????????
?????? 3 ???????????????????
??????-1 ????????????????
*/
public int type (){
//to be added
}
}
????1.3.3?????? JUnit ???????????????????????????
????(1)????????????????ε????????
????(2)???????????????ε????????
????(3)????????????????ε????????(???:???????????????)
????(4)?????????????????????ε????????
????(5)????????????????????
????4????д ant ???????????????
??????????????????к???????????
???????:????????JVM??Open JDK6.0??eclipse??3.8 Juno??JUnit??????4.11
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11