0
我是新來的java和Android。在下面的代碼片段中,當用戶名爲&的密碼不正確時,我顯示一條錯誤消息。現在,我需要在2次錯誤嘗試後在錯誤消息中添加一些額外的信息。 如果我需要設置一個計數器來識別嘗試? 我該怎麼做?根據編號顯示錯誤消息。嘗試?
public void testBadCredentials() throws Exception {
RestClientFactoryTest.setPrefixAllInstances("login-failure");
XMLRPCFactoryTest.setPrefixAllInstances("login-failure");
mSolo.enterText(0, "test"); //username
mSolo.enterText(1, "test"); //password
mSolo.clickOnText(mSolo.getString(R.string.sign_in));
boolean errorMessageFound = mSolo.searchText(mSolo.getString(R.string.username_or_password_incorrect));
assertTrue("Error message not found", errorMessageFound);
}