誰でも私を助けることができます。テキストビューのテキストの変更を待つためにテストケースをスリープさせたいのですが、Thread.sleep() が機能しないようです!
背景: ActivityUnitTestCase を使用してアクティビティの 1 つをテストします。以下はテストケースです。ログから変更されたテキストを取得できません。
public void testCanStartup() throws Exception{
m_activty = startActivity(m_intent, null, null);
assertNotNull(m_activty);
//get textview to check the view text's changes when oncreate and onresume
TextView mem_percentview= (TextView) m_activty.findViewById(cn.opda.a.phonoalbumshoushou.R.id.mem_percent);
Thread.sleep(50000);
getInstrumentation().callActivityOnResume(m_activty);
Log.v(DEBUGTAG,"mem text result is : " + mem_percentview.getText().toString());
TextView actual_mempercentview = (TextView) m_activty.findViewById(cn.opda.a.phonoalbumshoushou.R.id.mem_percent);
assertEquals(mem_percentview.getText().toString(),actual_mempercentview.getText().toString() );
}