I've been developing in Java for several years and love TDD. I'm fairly new to developing for Android and am having to spend lots of time understanding how to test drive my Android development.
Why aren't there any useful tests for the examples that get promoted? IOSched, for example, has 78 classes. How many tests does it have? NONE! Actually it does have a directory called tests.old. Let's look in there... How many tests are there? Seven...YES, just SEVEN! What do those tests actually test? Four of them test a utility class that parses XML. What about the other three? They test how to get those XML records from a Provider and then mindlessly goes through checking lots of strings and other entries match. One test is 160 lines long and has about 90 asserts! Where are the tests for the Activities, the Fragments and all those other Android components? Why aren't we seeing a decent set of tests included with these examples? Does anyone know how to write decent unit tests for Android? Is this why we aren't seeing any examples with useful tests? Is it because no-one knows how to write useful tests? I have read in many other locations there are various TestCases available for testing applications but where are some useful examples for someone new to developing on Android? I think this goes some way to explaining why there are many bad practices in the Android examples and the API itself. The number of bad smells in the code - static variables, feature envy, public member variables, reliance on inheritance over composition. The list goes on. It's as if we were back in the mid-nineties. I think the lack of tests we're seeing is because the API wasn't developed using tests. It wasn't designed for use and now it's difficult to test. I hope I get lots of people able to prove me wrong on this who have useful tests based around ActivityUnitTestCase, some of the Instrumentation test cases and using many of the mock objects that are available. Are we going to start seeing some tests being provided with these example apps? In the meantime, can anyone point me in the direction of some useful, but elusive, examples? Many thanks to anyone who can assist. Trev -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en