Android Unit Test ?????
?????Lee????? ???????[ 2017/7/7 9:41:18 ] ??????????? ??????? JUnit
????????????о??????г????? Android ?????????????????????????????????????п???????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????
????Java Tests
????JUnit
????JUnit ????? xUnit ??????????????????????1998???? SmallTalk ?????? SUnit?????????????????? Java ??????????????
????JUnit ?? Android ???????????????????? Android ?????????????????????????? mock ???????????????Щ????????????
??????????????????????????????? JUnit ?? TestNG ???????????????о?????? JUnit ???Щ?????????? TestNG ??????У?
????TestNG
????TestNG ???????????????Cédric Beust???? JUnit ???????????? JUnit ?????д???? ???? ?? ???? ???????????????????
????TestNG ?? JUnit ????????????????棺
?????? JUnit ?У????????????е??????????????????????????????????????????????????β????????????????ò????????乲???Щ????ò?????
???????? JUnit ??????1????????????—— TestSetup ???????????????????????????JUnit ?? TestSetup ??????????????????????????? JUnit ??????????????????????????????
??????????TestNG ?????????????°汾?? JUnit ?????????????????????α????????2004?????????????θ?????2015??12????????TestNG ?????????????????????????? JUnit?????????????? JUnit ??????????
????Mockito
????Mockito ?????? EasyMock ???????????????????μ??????????? EasyMock ?????2015????????
????Mockito ????????????????????
????????????????????????????
????????????????
????Java ?????????????????????????
????Features And Motivations
??????????????????????????y???“????”??????????????????????????“????”?? What are the limitations of Mockito
??????????Щ???????? PowerMock ????????????????????? PowerMock ???Java ??????????????????????
????jMock
????jMock ??????????? mock ????
??????2008?????????μ? 2.6.0-RC1 ??????????2012?????? 2.6.0-released ?汾????????????????????4??????????汾??????????????????ɡ?
????PowerMock
????PowerMock ????????????????? mock ????????????Mockito ?? PowerMock ?????????????????????????????????汾???????????????????
??????????? CGLib????????????????????? mock ??????????????????????? PowerMock ????????????????????????????飺?????????з???????
??????????????????λ????ο????????????????????????????????????????? gradle ?????? PowerMock ?????????????????????????????????????? Mockito ???????????????? PowerMock ??????????????汾??????????????????? Mockito???????? PowerMock ??????汾??
????JMockit
????JMockit ??2014????????? commit????????????????????3??????????? Github ???濴??????????????????????????????????????????????????????????
?????о? Android ???????ü?????????????????????????
????????????????????? PowerMock????????????????????????????????? when/thenReturn ??????????????????????
???????????? JMockit ????????飬?????? Mockito&PowerMock ??????
????Android Test
????Robolectric
????Robolectric ??д????? Android SDK ?????????? JVM ????? Android ????????????
???????? ??? ?е???????Shadow class ?????????????? Android OS ?μ????????????????? shadow ???????????? Mockito ?? mock ????????????????????????? Mockito ??????????á?
???????????????????? Mockito???????????????????????????? Mockito ????? Robolectric ????????????????????? Android SDK ???Щ native ????????? mock ????????????????? Robolectric ?????????
????Espresso & UI Automator
????Espresso & UI Automator ?????????? Google ???????? UI ??????????????????????в???????????????в?????
???????????????????????????Щ??????
????Espresso?????????е?????? UI ????
????UI Automator?????????????????????ù????? UI ?????
?????????????????漰????????????????????о????????????????????????????á?
????Others
????Hamcrest
????Hamcrest ????????????? Assertion ?? API ?????????
??????
???·???
??????????????????
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