??????????????У??????????????????????????????????????Ч??????????????????????С????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?????????????