Testing strategies on Android

1 view
Skip to first unread message

Carl H.

unread,
Dec 8, 2009, 6:27:26 AM12/8/09
to LondOnAndroid
Hello All,

I ve been struggling to find a good way to test properly on Android.
The latest SDK comes with a code coverage tool and I keep mocking up
objects myself as other frameworks seems to fail the classloading
mechanism.

Which tools are you using when testing on Android? Has anybody managed
to test locally by mocking up the android.jar? Any comments?

Cheers,
Carl

Jan Berkel

unread,
Dec 8, 2009, 8:27:25 AM12/8/09
to london...@googlegroups.com

hi carl,

I ve been struggling to find a good way to test properly on Android.
The latest SDK comes with a code coverage tool and I keep mocking up
objects myself as other frameworks seems to fail the classloading
mechanism.

I try to separate android related logic and app logic, so I can test them separately.
It helps to have some of the commons jars in your local classpath (httpclient etc) so you can test things like API interaction.

If I really need to test android specific stuff I use the instrumentation testrunner.
it's a bit of a pain to set up because you need a separate project, but with a good build system it's not much of a big deal, except for the delays uploading & running the package on the emulator. it'd be nice if you could replace test classes on the emulator directly (without having to build and install a package), but not sure if that's possible.


 jan

Carl-Gustaf Harroch

unread,
Dec 8, 2009, 9:34:24 AM12/8/09
to london...@googlegroups.com
I ve followed more or less the same principle with 3 projects:
1. actual project
2. local test project with minimal dependencies on andorid.jar
3. tests running on emulator with instrumentation

I still struggle to find a good technic where my test code takes much
more time to write then my actual code. I keep stumbling across issues
with classloading and so forth.

Have you followed this by any chance:
https://sites.google.com/site/androiddevtesting/

Mockito is very nice but did not really manage to get it fully
working. Kevin has though. I tend to mock the object myself but that
bloats the code tremendously.

./C

2009/12/8 Jan Berkel <jan.b...@gmail.com>:
> --
>
> You received this message because you are subscribed to the Google Groups
> "LondOnAndroid" group.
> To post to this group, send email to london...@googlegroups.com.
> To unsubscribe from this group, send email to
> londonandroi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/londonandroid?hl=en.
>



--
Carl-Gustaf Harroch

Sent from Bracknell, Eng, United Kingdom
Reply all
Reply to author
Forward
0 new messages