I've written the ff. behavior test. Is writing a test that waits for 31 mins to cover expiration scenarios acceptable and common practice?
public class ExpiredTokenBehaviorTestCase extends ActivityInstrumentationTestCase2<ResetPasswordActivity> {
protected Solo solo;
public final static int TOKEN_EXPIRATION_MINS = 31 * 1000 * 60; // 31 minutes, sanity check, can't do math
public ExpiredTokenBehaviorTestCase() {
super(ResetPasswordActivity.class);
}
@Override
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
}
/**
* Expired
*/
public void testExpiredPassword() {
solo.typeText(0, "+639224424166"); // type in mobile number to send the verification code
solo.clickOnButton("Next >"); // click next
if (solo.waitForActivity(VerificationActivity.class)) {
solo.typeText(0, "ab2f1de"); // valid code
solo.sleep(TOKEN_EXPIRATION_MINS); // wait for token to expire
solo.clickOnButton("Next >"); // now click on next
solo.waitForText("Verification code expired"); // should show the code expired
}
}
}
Aucun commentaire:
Enregistrer un commentaire