Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been experimenting recently with Android applications.

I've developed the convention (which I've seen used elsewhere) of placing my unit tests in a parallel source folder within an Eclipse project. This works well because the Eclipse JUnit runner can find the tests easily and the project with it's tests are nicely contained in the project.

However, Android applications have a very specific structure, and I don't think that my normal unit tree design will work. Also, I don't really want my test code in the published app; it could effectively double the size on disk. How are Android unit tests usually organized?

share|improve this question
up vote 4 down vote accepted

You typically set up a separate project for Android unit tests. There's an article on the Android Developer's site called Testing Fundamentals that takes you through the steps of setting up a test project in Eclipse. Also, see the Activity Testing Tutorial for a somewhat more advanced (and detailed) guide to testing Android apps.

share|improve this answer
Note also that the Android SDK has support for running your unit tests against the simulator using Ant, so you can have continuous integration run those for you. – jjb Mar 21 '11 at 19:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.