Issue
I just getting started with Robotium, writing my first test and I'm getting this weird error:
junit.framework.AssertionFailedError: 2131165500 EditTexts are not found!
This is my my test case
public class TestRegistrationActivity extends ActivityInstrumentationTestCase2<RegistrationActivity>{
private Solo solo;
public TestRegistrationActivity() {
super(RegistrationActivity.class);
}
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
@UiThreadTest
public void testSomeStuff(){
for (View v : solo.getCurrentViews()) {
Log.d(v.getClass().getSimpleName()+": "+v.getId());
}
solo.getEditText(R.id.txtCountryCode);
}
}
And this is the log:
03-13 17:06:18.318: D/DEBUG(7907): EditText: 2131165500
03-13 17:06:18.322: D/DEBUG(7907): PhoneEditText: 2131165501
As you can see:
- The
solo.getCurrentViews()
does indeed recognize that the view with id2131165500
exists. - The
solo.getEditText(R.id.txtCountryCode)
line always fails.
What could be wrong?
Solution
Fixed.
The problem was that I thought solo.getEditText(int)
took a View
id as parameter. Instead it took the view's index.
Answered By - fernandohur
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.