Wednesday, August 10, 2011

[android-developers] Test Case Error

I have a fairly simple Test Project that tests the user interface of
an activity. My problem is that it fails toward the end of the test
and i don't know why.

1) The preconditions for getActivity(), the buttons and view pass
2) The test that the view is visible passes
3) The test that the view is empty when presented to the user passes
4) The test that text CAN be entered into the view FAILS.

private static final String TRIP_RESULT = "TestTrip";
.
.
.
mEditTextTripName = (EditText)
mActivity.findViewById(R.id.EditTextTripName);
.
.
.
@SmallTest
public void testViewFull(){
mEditTextTripName.clearComposingText();
TouchUtils.tapView(this, mEditTextTripName);
sendKeys("TestTrip");
String tripName = mEditTextTripName.getText().toString();
assertEquals("The trip name should be:", TRIP_RESULT, tripName);

}

The test fails on assertEquals(), with the following error message:

junit.framework.ComparisonFailure: The trip name should be:
expected:<TestTrip> but was:<>

Any thoughts are appreciated.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment