????????Agile????????????????????????????????????????????????????????????????????в????????????????????????????TDD??????????п????????????????????????????????????????


??????????????

?????????????windows phone 8????????????!

 

????MDC2012??9??1???????????λ???????????????????iOS/Android/WP????????????!


????QCon????2012??Pragmatic Programmer??????????????????Dave Thomas

????RightScale??????????????Jonathan Siegel???μ?QCon????2012

????Amazon?????????????????????Amr Elssamadisy???μ?QCon????2012


?????????????

 


????QCon????2012???10??25~27???????????8????????????????!

 

????Android??????????????????????????????????????????Android??????????????????????????????????????????????????????????Ч?????????

????Android????????????м??????????????(Instrumented Test)?????????????????????????Robotium??????????????Selenium????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????mock??????????????????????????????????????????????????????????д???????????????????????????????????????????????????????????????????????????????????????в???????????????????????????????Delvik?????????????????????????????????????????TDD?????п??????????????????????????


???????????Щ????????????????????????????У????????????????????????Andorid.jar????????????????????????????????????placeholder???????????????????????????????????????stub???????????е??????Android?????????stub???????????????????Android.jar?????????е???????????????java.lang.RuntimeException(“Stub!”)??????????????????????????????Android??????????????????????????????????Android????????????????????????????

????????????????????????POJO???е??????????????Android??????????Mock??????????????????????????????????????????????ζ????????????????????????????mock??stub?????????Android?н?????????????XML?????????????????л??????????????????????£?UI??????????????????????


????????????????????Android?????????(static??????final????????Context??Resources?????)????????????Android?????????в???????????????

????????????????????????????????£??????????????????????????

 

????????????????????MVP????Robolectric

????Android??????????????????MVP?????п???????MVC???????Android?е?Activity??????????????Controller???????????????????????????????????棬??????????????????????????????????????????????漰????????????????????Activity????????????????±???????????????????и?????????????????????????(Presneter)?????Activity?????MVP????View????????UI??????????????UI?????Presenter?????(Listener???)?????????????Щ???????(????????????Presenter????)??????????

 

???????????????????????????????????????????????????????????????mock Activity????????????(Presenter?е????)???в????

??????????????????????Android??????????????????Robolectric???????


????Robolectric????????????????У?????????Android SDK??jar???(?????????????stub??)????????????????????????JVM???(???????????????)??????????????????Android ??y??в?????????????Roblectric???????Android?ж?XML????????????View??Layout??????????????????? Android?????????????????????????????У??????????????????????mock??????????????????Android?????????в????

????Robolectric????????????????

????Robolectric?????javassist?????????????Android.jar?????byte code??Robolectric????JVM????Android.jar?????????д????????????Roblectroic??????Щ?????з????(null????0) ??????????? ?????????Щ???????????Shadow Objects?????Android SDK??????Shadow Objects??Robolectric???????????Android.jar??????????е????????????????????????????????????????? assert???????в????????????Robolectric?????????Shadow Objects???????????????????о????????????????? ??

 

????Robolectric?????

????????Robolectric??????????????????test runner(RobolectricTestRunner)?????У??????????????RobolectricTestRunner?????????????? test runner???????乹???????趨????????AndroidManifest.xml??resource?? ???磺