???????????
????????????unit testing?? ???????????е?С??????????м????????
?????????????????????????????????????????д???
?????????????????????ж???????н??????????????????????
????????????????????????????Test Case?? ??
????JUnit
????JUnit?????Java??????????????
????????????http://junit.org/
????Java????IDE??????Eclipse??????JUnit????????build path?????Library??????????汾???ɡ?
????JUnit??????????汾??JUnit 3.8??JUnit 4???????÷?????????÷???????
???????????????????ν???JUnit???????????????????
????http://www.cnblogs.com/mengdd/archive/2013/02/02/2890204.html
????????????????????????÷???
????1.??д??????????
?????????????????????JUnitTest???????д????????Calculator??
package com.mengdd.junit;
public class Calculator
{
public int add(int a?? int b)
{
return a + b;
}
public int subtract(int a?? int b)
{
return a - b;
}
public int multiply(int a?? int b)
{
return a * b;
}
public int divide(int a?? int b)
{
return a / b;
}
}
????2.???JUnit??
?????????????JUnit??????????
?????????????Properties->???Java Build Path->???Libraries->Add Library...

?????????????????JUnit?????Next???????JUnit 3????JUnit 4.
??????????????JUnit 3??
????3.??????????
?????????????????????
????1.???JUnit????????????????????????????
?????????????????????test??source folder?????????????????????????????????????????????????????
????????????????????е?????????class?????????????bin??????С?
????2.?????????????????????λ???????????棬??????????????????
???????????????в??????????????????????????λ???????????檔
????3.???????????????
??????????????????????????Test??
?????????????????????£?

????4.??????????д
?????????????????TestCase??
????TestCase??????:
????public abstract class TestCase
????extends Assert
????implements Test
????A test case defines the fixture to run multiple tests.
????To define a test case
????1) implement a subclass of TestCase
????2) define instance variables that store the state of the fixture
????3) initialize the fixture state by overriding setUp
????4) clean-up after a test by overriding tearDown.
????Each test runs in its own fixture so there can be no side effects among test runs.
???????????ο??????л????JUnit??????????????????????????
??????????????????Assert???μ?????????static void??????