title: Unit testing for EditTextView. How do I do it?
body: <pre><code>public class LoginActivityTest extends ActivityInstrumentationTestCase2&lt;Login&gt; {
  
  
          Login mActivity;
          private EditText username;
          private EditText password;
  
            @SuppressWarnings("deprecation")
          public LoginActivityTest()
            {
                super("com.main.account.Login",Login.class);
            }
  
  
            @Override
          protected void setUp() throws Exception {
                super.setUp();
                mActivity = this.getActivity();
  
                username = (EditText) mActivity.findViewById(R.id.username);
                password = (EditText) mActivity.findViewById(R.id.password);
                        }
  
            public void testPreconditions() { 
                assertNotNull(username);
                assertNotNull(password);
              }
  
  
            public void testText() {
                assertEquals("hello",username.getText());
                assertEquals("hello123", password.getText());
              }
  
  }
  </code></pre>
  
  <p>Error I get is this: </p>
  
  <pre><code>04-18 16:03:47.132: I/TestRunner(12376): junit.framework.AssertionFailedError: expected:&lt;hello&gt; but was:&lt;&gt;
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.Assert.fail(Assert.java:47)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.Assert.failNotEquals(Assert.java:282)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.Assert.assertEquals(Assert.java:64)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.Assert.assertEquals(Assert.java:71)
  04-18 16:03:47.132: I/TestRunner(12376):    at com.crumbs.main.test.LoginActivityTest.testText(LoginActivityTest.java:46)
  04-18 16:03:47.132: I/TestRunner(12376):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-18 16:03:47.132: I/TestRunner(12376):    at java.lang.reflect.Method.invoke(Method.java:507)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:204)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:194)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:186)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.TestCase.runBare(TestCase.java:127)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.TestResult$1.protect(TestResult.java:106)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.TestResult.runProtected(TestResult.java:124)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.TestResult.run(TestResult.java:109)
  04-18 16:03:47.132: I/TestRunner(12376):    at junit.framework.TestCase.run(TestCase.java:118)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
  04-18 16:03:47.132: I/TestRunner(12376):    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
  </code></pre>
  
  <p>How do I test it then? As in, how do I set the values for the EditText so that I can test it here? </p>
  
  <p>The documentation is a bit scattered. </p>