Search code examples
androideclipseadteclipse-juno

Android Test Project root directory issue in Eclipse


According to this page, I should create my test project in a \tests directory in the project that the tests are for. However, when I uncheck "Use default location" in the "New Android Test Project" wizard and manually set the location to the \tests directory in the main project, a new directory gets created in the main project that is the name of the test project with -test appended to the end of it, and the \tests directory remains empty.

I am using Eclipse 4.2 Juno and the most recent version of the Android SDK as of 9/5/2012, which I believe is v20. I'm assuming this is a problem specific to either Eclipse Juno or Android SDK v20 as this post suggests it works in both 3.5 and 3.6 of Eclipse and Android SDK v14. I'm also using Windows 7 Ultimate x64 if that's relevant.

I am hoping to receive either an explanation of why Eclipse creates the directory like above or a workaround to get my test project created in the \tests directory. If neither of those is possible, at least confirm in a comment that you can recreate the issue so I know I'm not just incompetent.


Solution

    1. Create Android Test Project as described in the question
    2. Remove the test project from the workspace
    3. Rename the file system directory created as the root of the project to "tests"
    4. Import the test project back into the workspace

    I don't know why I didn't think of that before I posted my question, but hopefully this will help someone else who also lacks the immediate grasp of the obvious like me.