Once upon a time, I avoided Eclipse for Android development. And life was good.
Along the way, I adopted a convention originally supported by the Android command-line build tools, of having a tests/ subdirectory containing the test code (e.g., MyProject/ being the home of the app, MyProject/tests/ being the home of the test suite). Android does an excellent job of allowing test code to reside in a separate-but-related project, and having it as a subdirectory kept the tests logically co-located with the project proper.
I am now switching to Eclipse, as I need to support it better for my subscribers. The only way for me to do a quality job of supporting it is to use it daily. And, since I have a quad-core with 4GB of RAM, Eclipse actually starts up in less than a minute. 🙂
However, preliminary research suggests that Eclipse does not support sub-projects (i.e., one Eclipse project having another Eclipse project in a subdirectory).
So, my questions are:
-
Am I correct in this assessment, and if I’m wrong, are there any particular steps I should take to ensure that Eclipse is happy? I find that Eclipse can sometimes get a wee bit cranky…
-
How are Android developers organizing test projects relative to the project being tested? Peer directories (e.g.,
MyProject/for the app,MyProjectTests/for the tests)? Peer subdirectories under some targeted common top (e.g.,MyProject/app/for the Android app,MyProject/tests/for the test suite?)? Something else?
BTW, I’m running Eclipse 3.5.2, if that matters.
Thanks!
I’ve been creating test projects with Eclipse 3.6.2 inside my main project just like you describe for command line tools (
MyProjectandMyProject/testare Android projects that both contain a src folder). You can create this test project using the New Android Test Project by deselecting “Default Location” and setting the path.None of my projects are very large, but the only problem I’ve had so far is that you cannot use the
MyProject/testfolder under the MyProject project. To be able to right click and run as a test case, you have to access files directly from the MyProjectTest project. To prevent you from having problems, you can add a Resource Filter to hide the test folder in Project Properties > Resource > Resource Filters.What problems have you seen?