I'm taking over an android project and I wish to introduce unit tests to the project, to help avoid possible regressions.

For normal java projects, I have two source folders: src and test. The src source folder contains all of my source files and my test source folder contains all of my unit tests, which I believe is pretty standard for keeping test separate from the source, so you don't have to ship with them.

I've been doing some reading online and the approach with android apps looks to be a little bit different. Several examples talk about setting up a 2nd project for an android test project and then referencing the android project.

I wish to confirm a few things:

  1. Is having a 2nd project for the testing the appropriate thing to do when it comes to testing android projects or am I just finding bad examples?
  2. Should all unit tests be android unit tests? E.g. Yes they should all be, or no I should mix between android unit tests and junit because junits have less overhead.
  3. What additional benefits do android unit tests give over junit tests? E.g. Handles to the emulator, etc.
Edit
Report