diff --git a/app/build.gradle b/app/build.gradle index ac15c07d7..6f8d001bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -41,18 +41,6 @@ android { } } - // Shared test code between Unit and Instrumented tests - sourceSets { - androidTest { - java.srcDirs += "src/sharedTest/java" - resources.srcDirs += "src/sharedTest/resources" - } - test { - java.srcDirs += "src/sharedTest/java" - resources.srcDirs += "src/sharedTest/resources" - } - } - flavorDimensions 'testing', 'license' productFlavors { stable { @@ -150,36 +138,31 @@ dependencies { // Testing // Unit Testing + testImplementation project(':shared-test') testImplementation 'junit:junit:4.13.2' - testImplementation 'androidx.test:core:1.4.0' - testImplementation 'androidx.test:runner:1.4.0' - testImplementation 'androidx.test:rules:1.4.0' - testImplementation 'org.mockito:mockito-core:4.6.1' + testImplementation 'androidx.test:core:1.5.0' + testImplementation 'androidx.test:runner:1.5.2' + testImplementation 'androidx.test:rules:1.5.0' + testImplementation 'org.mockito:mockito-core:5.3.1' testImplementation 'org.mockito:mockito-inline:4.6.1' - testImplementation 'org.robolectric:robolectric:4.5.1' + testImplementation 'org.robolectric:robolectric:4.10.3' testImplementation 'com.github.blocoio:faker:1.2.8' testImplementation 'org.ooni:oonimkall:2023.07.18-162729' testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.36' // Instrumentation Testing + androidTestImplementation project(':shared-test') androidTestImplementation 'tools.fastlane:screengrab:2.0.0' androidTestImplementation 'com.github.blocoio:faker:1.2.8' - androidTestImplementation 'androidx.test:runner:1.4.0' - androidTestImplementation 'androidx.test:rules:1.4.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0' - androidTestImplementation('androidx.test.espresso:espresso-contrib:3.4.0') { - exclude group: 'com.android.support', module: 'appcompat' - exclude group: 'com.android.support', module: 'support-v4' - exclude module: 'recyclerview-v7' - } - androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0') { - exclude group: 'com.android.support', module: 'appcompat' - exclude group: 'com.android.support', module: 'support-v4' - exclude module: 'recyclerview-v7' - } - androidTestImplementation('com.schibsted.spain:barista:3.9.0') + androidTestImplementation 'androidx.test:runner:1.5.2' + androidTestImplementation 'androidx.test:rules:1.5.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1' + androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'com.schibsted.spain:barista:3.9.0' androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:2.36" + } static def versionCodeDate() { diff --git a/settings.gradle b/settings.gradle index 8a8583d06..ee1a417a5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,3 +2,4 @@ include ':app' include ':engine' include ':engine-experimental' include ':applogger' +include ':shared-test' diff --git a/shared-test/.gitignore b/shared-test/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/shared-test/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/shared-test/build.gradle b/shared-test/build.gradle new file mode 100644 index 000000000..5ef394ce7 --- /dev/null +++ b/shared-test/build.gradle @@ -0,0 +1,66 @@ +plugins { + id 'com.android.library' +} + +android { + namespace 'org.openobservatory.ooniprobe.shared.test' + compileSdk 33 + + defaultConfig { + minSdk 21 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + flavorDimensions = ['testing', 'license'] + productFlavors { + stable { + dimension 'testing' + } + experimental { + dimension 'testing' + } + dev { + dimension 'testing' + } + + fdroid { + dimension 'license' + } + full { + dimension 'license' + } + } +} + +dependencies { + implementation project(":engine") + implementation project(":app") + + // Dependency Injection (https://dagger.dev/) + implementation 'com.google.dagger:dagger:2.36' + annotationProcessor 'com.google.dagger:dagger-compiler:2.36' + + // Database Library (https://github.com/agrosner/DBFlow) + implementation 'com.github.Raizlabs.DBFlow:dbflow-core:4.2.4' + implementation 'com.github.Raizlabs.DBFlow:dbflow:4.2.4' + annotationProcessor 'com.github.Raizlabs.DBFlow:dbflow-processor:4.2.4' + + // Gson Serialization Library (https://github.com/google/gson) + implementation 'com.google.code.gson:gson:2.8.9' + + implementation 'com.github.blocoio:faker:1.2.8' + implementation 'commons-io:commons-io:2.6' + + // Networking Library (https://square.github.io/retrofit/) + implementation 'com.squareup.retrofit2:retrofit:2.9.0' + implementation 'com.squareup.retrofit2:converter-gson:2.9.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' + + implementation 'androidx.appcompat:appcompat:1.6.1' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} \ No newline at end of file diff --git a/shared-test/src/main/AndroidManifest.xml b/shared-test/src/main/AndroidManifest.xml new file mode 100644 index 000000000..a5918e68a --- /dev/null +++ b/shared-test/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/di/TestAppComponent.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/di/TestAppComponent.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/di/TestAppComponent.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/di/TestAppComponent.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/di/TestAppModule.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/di/TestAppModule.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/di/TestAppModule.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/di/TestAppModule.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/di/TestApplication.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/di/TestApplication.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/di/TestApplication.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/di/TestApplication.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/EventResultFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/EventResultFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/EventResultFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/EventResultFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/JsonResultFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/JsonResultFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/JsonResultFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/JsonResultFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/MeasurementFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/MeasurementFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/MeasurementFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/MeasurementFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/NetworkFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/NetworkFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/NetworkFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/NetworkFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/ResponseFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/ResponseFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/ResponseFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/ResponseFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/ResultFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/ResultFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/ResultFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/ResultFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/TestKeyFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/TestKeyFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/TestKeyFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/TestKeyFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/UrlFactory.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/factory/UrlFactory.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/factory/UrlFactory.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/factory/UrlFactory.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/DatabaseUtils.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/utils/DatabaseUtils.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/DatabaseUtils.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/utils/DatabaseUtils.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/FormattingUtils.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/utils/FormattingUtils.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/FormattingUtils.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/utils/FormattingUtils.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/TestSuiteUtils.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/utils/TestSuiteUtils.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/TestSuiteUtils.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/utils/TestSuiteUtils.java diff --git a/app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/models/TestSuiteMeasurements.java b/shared-test/src/main/java/org/openobservatory/ooniprobe/utils/models/TestSuiteMeasurements.java similarity index 100% rename from app/src/sharedTest/java/org/openobservatory/ooniprobe/utils/models/TestSuiteMeasurements.java rename to shared-test/src/main/java/org/openobservatory/ooniprobe/utils/models/TestSuiteMeasurements.java