??????Junit????????
???????????? ???????[ 2015/6/2 10:04:04 ] ????????????????
?????????????????????写??????????????????????写??????????
?????????????????写?????????????????????????????胁?????????????
????github???????? https://github.com/luhan420/jiedui/tree/master
????????????????http://www.cnblogs.com/tj1024/p/4490680.html
???????????
??????????????娣�
??????????????Junit4???胁????Eclipse??????Junit4??????
????1) ??????????
???????????DAO??service?????????????写??????????action????struts2.0??????????????貌????
????1. ??????????????????? ???? + Test????junit4????????????????????????
??????????????????????????????????
????2. ?????????src??械?test???????胁??????????????????????????????
??????????????????
????3. ????????????????????????????????
????4. ???????????????????????????????????
????2) ???????????写
????1. ??????????test????????(testXXXX)??JUnit??????????????械?????
?????小???????????????????????????????????????????????????????????
????2. ????????校???????(assertXXX??fail??????????????JUnit???)??????
???????????卸?????????????????????????????????????????????????????????????????????
????3. ??????????????????????????????泄?????????????????????????
?????????????????????????????????????????
????3) ????????????
????????????????????????????????????????????sql?????????????????????????????????????????????????????????????????????
????4) ????????
????????????????Entity model?????????????????????????????Entity???????????????????Entity??????set/get????????????y??械???????
????5) DAO??????
????????DAO???????写????????????DAO?????????????????胁????????????????????写????????????????????锌??????????????????????????????????????????????????????????
????6) Service??????
????Service????????????Service???????????????????????????????
????7) Struts??????????????
????????…
????????Eclipse??JUnit???梅?
???????????????JUnit???梅?????????梅?????????????????
???????????????????????Eclipse??JUnit???梅???
????????????????写??????????????????????写??????????
????1) ????Math??
????/**
????* @???????May 9??2015
????* @?????? */
????public class Math {
????public static int divide(int x??int y) { return x/y;
????}
????public static int multiple(int x??int y) { return x*y;
????}
????}
????2) ????????????
??????????????????????????????new->other??
????????main???????????????????????IDE???胁???? setUp()???????????????????????????????????????? tearDown()?????????????????????????????????????
????setUpBeforeClass()????????????????????????????????????????????? tearDownAfterClass()????????????????????????????????????????? constructor()???????????????
??????????????
??????????????????????伞?
?????????????鈥�???
????/**
????* @???????May 9?? 2015
????* @?????? */
????public class MathTest { @BeforeClass
????public static void setUpBeforeClass() throws Exception { }
????@AfterClass
????public static void tearDownAfterClass() throws Exception { }
????@Test
????public void testDivide() { fail("Not yet implemented"); }
????@Test
????public void testMultiple() { fail("Not yet implemented");
????}
????}
?????????
????@BeforeClass????????????????????????????????????????危?@AfterClass???????????????????????????????????巍???2??????????????????@Before??@After??????????????????????????????????????????????????????(????????????????????????????@Before??@After?????)
????@Test?????????????????????????????????????????小?
??????

???路???
??????????????????
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