??android?н??е??????
???????????? ???????[ 2012/9/3 11:54:42 ] ????????
??????????????У??????????????????????????????????????Ч??????????????????????С????bug??????????????????????????? ?????“??????е????????”?????????????ó???????????????????????????????“XJ??????????鷳???????μ?”??????????????????? ???????????Щ??myeclipse?????????????MM??????????????????????????????????????????????????????????????????????????
????android???????????????????????android project???????????android test project??File-->Project-->Android-->Android Test Project????????????????“New Android Test Project”??????????????“an existing Android Project”????????????????????????????????????????????????????δ?????ɡ???????Android Project????? ?????????Щ??????????????????????“finish”?????android test projectOK??--??????????ù?????
????android test project?????μ???????android project???????src?μ?package??????test?????????????????junit?????????????????????? ????New-->Junit Test Case??????????junit????????“New Junit3.0 Test”??Junit4.0?????????????Щ???Junit4????????????Junit???????????????????????????????????????????? ??...???????setUp?????“finish”?????????д????
???????????????????????£?
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.helloAndroid.Books;
import com.helloAndroid.HelloAndroid;
import com.helloAndroid.R;
import android.R.xml;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class Junit3 extends ActivityInstrumentationTestCase2<Books> {
ListView listView;
Books books;
public Junit3() {
super("com.helloAndroid.HelloAndroid" ??Books.class);
// TODO Auto-generated constructor stub
}
protected void setUp() throws Exception {
super.setUp();
books = this.getActivity();
}
//???testPreconditions()??????????????????????????
public void testPreconditions() {
//assertNotNull(integer);
}
//?????????
public void testText() {
//assertEquals(resourceString??(String)mView.getText());
List<Map<String?? Object>> resourceName = new ArrayList<Map<String??Object>>();
Map<String ??Object> map = new HashMap<String?? Object>();
map.put("line1"?? "????Junit");
map.put("img"?? R.drawable.weikexue);
resourceName.add(map);
//listView = (ListView)books.findViewById(com.helloAndroid.R.id.l)
SimpleAdapter notes = new SimpleAdapter(
books??
resourceName??
R.layout.rows??
new String[]{"line1" ??"img"}??
new int[]{R.id.text1?? R.id.img});
//books.setListAdapter(notes);
}
}
???????????????ActivityInstrumentationTestCase2????????????????????????????? ????ActivityInstrumentationTestCase2<Books>??Books???????setUp() ???????????????????????????????“setUp()”??????????????????????????д????????д???????? testPreconditions()??testText()??testText??????????????testPreconditions()??????? ???????????м????????????????д?????????????????????google????????????????????????????????????Junit4??????? annotation?????????????????android test project????junit4???????????Ч??????????????????junit?????????????????????е??????????????
?????????????????????android???????????????????????ActivityInstrumentationTestCase2?????????????
??????
???·???
??????????????????
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