user1730789
user1730789

Reputation: 5177

Android Instrumentation - Assert fails

I have a small activity that contains a textview and a password. I have written a small text to test this activity. But the assert on the last line is failing. Could someone please tell me why ?

loginScreenActivity=startActivity(mStartIntent, null, null);
        assertNotNull(loginScreenActivity);
        mInstrumentation.waitForIdleSync();

        final EditText userName=(EditText)loginScreenActivity.findViewById(R.id.userName);
        final EditText password=(EditText)loginScreenActivity.findViewById(R.id.password);


        loginScreenActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                userName.requestFocus();
            }
        });

        mInstrumentation.waitForIdleSync();

        this.sendKeys(KeyEvent.KEYCODE_R);
        this.sendKeys(KeyEvent.KEYCODE_SHIFT_LEFT);
        this.sendKeys(KeyEvent.KEYCODE_A);
        this.sendKeys(KeyEvent.KEYCODE_F);
        this.sendKeys(KeyEvent.KEYCODE_A);
        this.sendKeys(KeyEvent.KEYCODE_Q);
        this.sendKeys(KeyEvent.KEYCODE_A);
        this.sendKeys(KeyEvent.KEYCODE_T);

        assertTrue(userName.getText().toString().equals("Rafaqat"));

Upvotes: 1

Views: 113

Answers (1)

Robin
Robin

Reputation: 10368

From the sequence, I guess you are inputing "rAfarqat"?

Upvotes: 1

Related Questions