私は、Androidに非常に新しいですし、Robotiumを使用していくつかの基本的なAndroidのテストを書いていますし、これは以下 AndroidのJunitテストは「ビュー階層を作成した元のスレッドのみがそのビューに触れることができます」と失敗します。
"android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views."
は、基本的なテストケースdecriptionあるとして例外で失敗: -
テストケース: -
public void testSearch() {
Activity a = getActivity();
SearchItemActivity search = new SearchItemActivity(solo);
search.searchText("ipod", a);
}
SearchItemActivity.searchText(String) is defined as
public void searchText(final String search, Activity act) {
Button v = (Button) act
.findViewById(com.test.mobile.R.id.text_search_field);
((Button) v).setText("");
((Button) v).setText(search);
solo.sendKey(Solo.ENTER);
solo.waitForActivity("FoundItemdDetailActivity");
solo.assertCurrentActivity("Expected FoundItemDetail activity","FoundItemdDetailActivity");
}
私のコードを変更する方法を教えてください。
私はあなたのテストケースは、ロック画面http://stackoverflow.com/questions/4545079/lock-the-android-device-programatically/10535284#10535284を解任しようとするので、それはだと思います –