1.我定義了一個測試解析JSON資料的類,方法裡呼叫了GSON框架的程式碼,但是在運行方法的時候出現了報錯:Test running failed: Unable to find instrumentation info for: ComponentInfo{com. example.lweicheng.splash.test/android.test.InstrumentationTestRunner}
如下為相關程式碼:
public class GsonTest extends AndroidTestCase { public void testJson() { String json = "{\"name\":\"小王\",\"age\":18,\"gander\":\"true\"}"; Gson gson = new Gson(); Person person=gson.fromJson(json,Person.class); Log.d("lweicheng",person.toString()); } class Person { private String name; private int age; private boolean gender; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public boolean isGender() { return gender; } public void setGender(boolean gender) { this.gender = gender; } public String toString() { return "name" + name + ",age:" + age + ",gender:" + gender; } } } 如下是Androidmanifest文件的配置 请问各位大神是否遇过同样的问题? 我的上述代码出了什么问题? 谢谢!
給你一個參考:
http://www.paincker.com/android-empty-test-suite
https://testerhome.com/topics/2098
就你的程式碼來看,你的targetpackage為:
com.example.lweicheng.splash.GsonTest
,這是你要測試的類別名稱.