测试类(见天气预报项目)
/**
* 在清单文件里进行配置
* <!--配置test工具类第1步-->
* <application在本标签外配置
*<instrumentation
* android:name="android.test.InstrumentationTestRunner"
* android:targetPackage="com.example.weather">
*</instrumentation>
*
* <!--配置test工具类第2步-->
* <application在本标签内配置
*<uses-library android:name="android.test.runner"/>
*/
publicclassTest extendsAndroidTestCase {
/*
* 在方法里添加测试内容
*/
publicvoid test(){
HttpUtil.loadWeather(mContext, "guangzhou",newOnLoadWeatherFinash() {
@Override
publicvoid onFinish(WeatherBeanweatherBean) {
// TODO Auto-generated method stub
Log.d("TAG",weatherBean.toString());
}
});
}
}
test工具类使用
1)清单文件中配置instrumentation
2)在Application里面,Activity外面
加上uses-library
3)创建一个Test类