From b756b5490f49bf0a12dd99ce38d3c4b9dc5e1290 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Sun, 30 Sep 2018 04:06:09 -0700 Subject: [PATCH] Set up unit test support in Gradle Summary: This works now: ``` ./gradlew :android:testDebugUnitTest BUILD SUCCESSFUL in 1s 39 actionable tasks: 39 up-to-date ``` Reviewed By: danielbuechele Differential Revision: D10101985 fbshipit-source-id: e3d1f17b29652061498d50a9218a94aaebee67e2 --- android/build.gradle | 14 ++++++++++++++ build.gradle | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index b024bd7cc..b4890336f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,15 @@ android { abortOnError false } + sourceSets { + test { + java { + exclude 'com/facebook/sonar/plugins/facebook/**' + } + } + } + + externalNativeBuild { cmake { path './CMakeLists.txt' @@ -45,6 +54,11 @@ android { implementation deps.lithoWidget implementation deps.rhino implementation deps.leakcanary + + testImplementation deps.mockito + testImplementation deps.robolectric + testImplementation deps.hamcrest + testImplementation deps.junit } } diff --git a/build.gradle b/build.gradle index d42b4277d..7b9472dc9 100644 --- a/build.gradle +++ b/build.gradle @@ -68,8 +68,10 @@ ext.deps = [ lithoTesting : "com.facebook.litho:litho-testing:$LITHO_VERSION", // Debugging and testing guava : 'com.google.guava:guava:20.0', - robolectric : 'org.robolectric:robolectric:3.0', + robolectric : 'org.robolectric:robolectric:3.3', junit : 'junit:junit:4.12', + hamcrest : 'org.hamcrest:hamcrest-library:1.3', + mockito : 'org.mockito:mockito-core:1.9.5', stetho : 'com.facebook.stetho:stetho:1.5.0', okhttp3 : 'com.squareup.okhttp3:okhttp:3.10.0', leakcanary : 'com.squareup.leakcanary:leakcanary-android:1.6.1',