Android???????????????
???????????? ???????[ 2013/12/18 10:40:39 ] ????????
??????????????????????AppPreferencesTest????????Android Junit Test???????У??????Junit????п?????????????????
?????????????δ?????????????????????????
public void testSecondAndMoreRun() {
prefs.isFirstRun();
assertFalse(prefs.isFirstRun());
}
|
????????????????????????????testSecondAndMoreRun???????????????????????????????????????????е?AppPreferences??????????′???
public boolean isFirstRun() {
boolean orgVal = isFirstRun;
isFirstRun = false;
return orgVal;
}
|
??????????????в???????AppPreferencesTest?????????????????????????????????????
??????????μ???????п????????????????в????????????????????????
?????????????????AppPreferences??????
@Override
public void onCreate() {
super.onCreate();
}
public void onTerminate() {
super.onTerminate();
}
public boolean isFirstRun() {
prefs = getSharedPreferences("mhcs"?? MODE_PRIVATE);
boolean orgVal = isFirstRun;
isFirstRun = false;
Editor editor = prefs.edit();
editor.putBoolean(PREF_IS_FIRST_RUN?? false);
editor.commit();
return orgVal;
}
public void setFirstRun(boolean isFirstRun) {
this.isFirstRun = isFirstRun;
}
public final static String PREF_IS_FIRST_RUN = "isFirstRun";
private SharedPreferences prefs = null;
private boolean isFirstRun = true;
|
???????????????????????????
public void testFirstRunTrue() {
createApplication();
prefs = getApplication();
Editor editor = mContext.getSharedPreferences("mhcs"?? 0).edit();
editor.clear().commit();
assertTrue(prefs.isFirstRun());
}
public void testSecondAndMoreRun() {
createApplication();
prefs = getApplication();
assertFalse(prefs.isFirstRun());
}
|
?????????????????testFirstRunTrue?????У????SharedPreferences????????????????????????????????С?
???????в????????????????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
?????????????????????????????????TDD?????????????????????????????Python????????????-????????????????????????????????????????????????????????????????Ч????????????????????????????????????????????Щ?????????????????????????TDD????????????ú???δ????????????? Test-driven development???????????????????????????????????????????????????????????????????????TDD(3)????????????TDD(2)
???·???
??????????????????
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????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????