简体   繁体   中英

Android gradle: how to run separately integration and unit tests?

Currently I have standard structure of project:

src

|---androidTest

|-------------------|---java

|----------------------------|---robotium

|----------------------------|---unit

|---main

|---------|---AndroidManifest.xml

|---------|---java

|---------|---res

According to documentation
I've placed unit and integration tests under androidTest folder.

Since instrumentation tests need lot of time, I placed it inside robotium folder(I use Robotium). Inside unti - jUnit tests respectively.

To run all tests I invoke ./gradlew connectedCheck - it's taking lot of time.

How to to run integration (inside robotium folder) tests and unit tests separately? I want to run these tests using gradle - it's for CI server. For example I want to run integration tests every night and unit tests - every hour..

Thanks!

According to the documentation JUnit tests should be places under - src/test/java and then you'll be able to switch between test sources by changing Test Artifact when selecting Build variants as shown:

as shown http://tools.android.com/_/rsrc/1423155717194/tech-docs/unit-testing-support/qSxL68MPv5.png?height=365&width=400

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM