Separate test project

78 views
Skip to first unread message

Greg Macdonald

unread,
Mar 24, 2015, 10:22:51 PM3/24/15
to adt...@googlegroups.com
I have a need to set up a suite of tests that only run in a specific context, so not with either the Android instrumentation (/androidTest) or unit (/test) set of tests.  I understand that in eclipse one would create a "test project" which was a separate project that ran against your app apk.  Is there a way to do this or something equivalent using Android Studio?

thanks,
greg

Xavier Ducrohet

unread,
Mar 25, 2015, 12:56:19 PM3/25/15
to adt...@googlegroups.com
Starting with 1.2/1.3, we'll slowly add features for standalone test projects (they will need to target a app subproject).

However, the separate Eclipse test project and the androidTest inside a gradle project are the same thing really. If you could tell us why this doesn't work for you, we can improve things. The feature in 1.2/1.3 will not be fundamentally different from androidTest, it's just organized differently (and allow having more than one test app for a single app).

thanks.


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Greg Macdonald

unread,
Mar 25, 2015, 5:31:52 PM3/25/15
to adt...@googlegroups.com
I need multiple test contexts.  I'm using Android Instrumentation Tests, with tests under /androidTest, for tests that run headless on a continuous integration server. These are a mix of unit and functional tests.  I need a separate context to run UI tests (the CI environment only runs headless), and another to run integration tests which hit production servers.

I had been using product flavors to satisfy the multiple context need, but that is obviously a mis-use of the mechanism and presents its own issues since product flavors don't currently propagate to submodules.

My latest "brilliant idea" is to move all code but the Application class from the app module to an appcommon library module, then add multiple application modules to the AS project workspace.  So, for example, the IntegrationTest module depends on all modules from the project except app and has its own Application.java file.  Instead of the old style of having a test.apk that runs against an app.apk (frankly, I don't know exactly how that works), I get a single test.apk that includes all the tests from integrationtest/.../androidTest plus all the app code from the modules.

So far, this seems to be working out pretty well.

greg

Reply all
Reply to author
Forward
0 new messages