Android Instrumentation - 断言失败

时间:2013-04-03 06:38:25

标签: android instrumentation

我有一个包含textview和密码的小活动。我写了一个小文本来测试这个活动。但是最后一行的断言是失败的。有人可以告诉我为什么吗?

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"));

1 个答案:

答案 0 :(得分:1)

从序列中,我猜你输入的是“rAfaqat”?