I'm trying to set some tests for my android app, and I'm testing that the creation of an entry in the database is displayed in my ListView.
here is some code snippet:
mDbHelper.createAccount();
assertEquals(1, mAccountListAdapter.getCount());
assertEquals(1, mAccountList.getChildCount());
the first assert works fine but in the second, getChildCount return 0.
So the adapter is good, but the listView does not display it?
When I test it manually, the feature works though.
mAccountList.getChildCount() refers to the ViewGroup's method that returns the number of the views that this view contains, it's not ListView's method itself. So your assertion is invalid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With