i get java.lang.NullPointerException: Attempt to invoke virtual method error when i try to run my android unit test. code:
public class LoginActivityTest extends ActivityInstrumentationTestCase2<LoginActivity>
{
LoginActivity m_Activity;
LinkableEditText editText;
public LoginActivityTest()
{
super(LoginActivity.class);
}
@Override
protected void setUp() throws Exception
{
super.setUp();
m_Activity = getActivity();
editText = (LinkableEditText)m_Activity.findViewById(R.id.login_dialog_msisdn);
}
public void testPreConditions()
{
assertNotNull(editText);
}
@UiThreadTest
public void testEditText()
{
assertEquals("",editText.getText());
}
im new to unit testing. what should i do in here?
Aucun commentaire:
Enregistrer un commentaire