Sample project to demonstration issue with Integration Tests and Android Studio
- Gradle build tool: https://gradle.org/
------------------------------------------------------------
Gradle 3.3
------------------------------------------------------------
Build time: 2017-01-03 15:31:04 UTC
Revision: 075893a3d0798c0c1f322899b41ceca82e4e134b
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_111 (Oracle Corporation 25.111-b14)
OS: Mac OS X 10.11.6 x86_64
- Gradle Java plugin https://docs.gradle.org/current/userguide/java_plugin.html
- Gradle TestSets plugin: https://github.com/unbroken-dome/gradle-testsets-plugin
- Spring Framework: https://projects.spring.io/spring-framework/
- Java 1.7
- Android Studio 2.2.3
When the integration tests are moved from under the unit test folder to the IntegrationTest folder they no longer build or run through Android Studio.
- Clone or download the repository
- Use the command line to build and run the tests: gradle clean build
- Note that all of the tests built and ran.
- Launch Android Studio and select File>New>Import Project
- Navigate to the build.gradle file
- If the Gradle Sync popup appears, press the Cancel button to manually set the path of a local Gradle distribution
- Open the "Gradle projects tool": View>Tool Windows>Gradle
- Press the "Execute Gradle Task" button (Gradle projects tool window, green dot surrounded by green circle)
- In the "Run Gradle Task" dialog enter in the "Command line" field '''clean build'''
- Press the OK button
- Note that the project builds the project and runs all of the tests
- In Android Studio, navigate to the file src/integrationTest/java/hello/HelloWorldIntegrationTests.java
- Note that the imports are not found, and the Spring Framework annotations are also not defined (displayed in red)
- Drag the HelloWorldIntegrationTests.java and HelloWorldIntegrationTests-context.xml file to src/test/java/hello
- Note that the imports are found, and the Spring Gramework annotations are defined
- incompatibility between Gradle 2.14 (Android Studio gradle plugin) and Gradle 3.3
- classpath not being set correctly for integration tests
- some other issue.