I'm new to testing and currently trying to write some tests in Android Studio. I have a sample application module and now trying to figure out, whether the instrumentation test needs to be a module of its own or whether the tests should go inside the src folder... I have read contradicting information on the web. If anyone had a sample, that would be great!
Asked
Active
Viewed 3,566 times
3
2 Answers
2
With eclipse ADT plugin and older version of the SDK it was a requirement to put the integration tests in a separate module.
With the gradle build system and android-studio you should be able to put your integration tests in src/test/java and running them from the IDE or gradle command line without pain.
That's why you find contradicting information on the web.
Here is the reference

ben75
- 29,217
- 10
- 88
- 134
-
Thanks for your answer! And what is the difference between putting it in the src folder and creating an Android Test Module through Android Studio inside my module? Currently I am not using gradle ... – Sep 17 '13 at 15:11
-
I don't know if it's possible to create an 'Android Test Module' with Android-Studio (not sure I understand what you mean). Putting your test code in the same module as the sources under test seems a very good practice, no more, no less. – ben75 Sep 17 '13 at 15:22
-
I edited my question and included a screenshot ... hope that helps to clarify. – Sep 17 '13 at 15:36
-
It seems to be a screenshot from IntelliJ, not Android-Studio ... or it is how it looks on MacOSX ? (In my version of Android-Studio 0.2.9 I don't have those options, but I've those in IntelliJ !) – ben75 Sep 17 '13 at 15:39
-
It's Android Studio 0.2.9. on Mac OS, inside "Project Structure" – Sep 17 '13 at 15:48
-
OK... surprising. I think "Android Test Module" is a concept that won't survive to the new gradle build tool. So I don't recommend to use it on new projects. – ben75 Sep 17 '13 at 15:54
2
This post contains a very good explanantion on how to do the integration testing in Android Studio: How can I create tests in Android Studio?

Community
- 1
- 1

markonovak
- 381
- 4
- 4