Skip to content

Commit

Permalink
RUM-5525 Add the integration tests for the SdkCore APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusc83 committed Aug 2, 2024
1 parent 405b9b4 commit 85fb24b
Show file tree
Hide file tree
Showing 14 changed files with 935 additions and 24 deletions.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ espresso = "3.5.1"
assertJ = "3.18.1"
elmyr = "1.3.1"
mockitoKotlin = "5.1.0"
mockitoAndroid = "5.12.0"
kover = "0.7.6"
kspTesting = "1.5.0"

Expand Down Expand Up @@ -177,6 +178,7 @@ elmyrInject = { module = "com.github.xgouchet.Elmyr:inject", version.ref = "elmy
elmyrJUnit4 = { module = "com.github.xgouchet.Elmyr:junit4", version.ref = "elmyr" }
elmyrJUnit5 = { module = "com.github.xgouchet.Elmyr:junit5", version.ref = "elmyr" }
elmyrJVM = { module = "com.github.xgouchet.Elmyr:jvm", version.ref = "elmyr" }
mockitoAndroid = { module = "org.mockito:mockito-android", version.ref = "mockitoAndroid" }
mockitoKotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockitoKotlin" }
kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kover = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" }
Expand Down
68 changes: 52 additions & 16 deletions reliability/core-it/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* Copyright 2016-Present Datadog, Inc.
*/

import com.datadog.gradle.config.AndroidConfig
import com.datadog.gradle.config.androidLibraryConfig
import com.datadog.gradle.config.dependencyUpdateConfig
import com.datadog.gradle.config.java17
import com.datadog.gradle.config.javadocConfig
import com.datadog.gradle.config.junitConfig
import com.datadog.gradle.config.kotlinConfig
Expand All @@ -26,10 +28,43 @@ plugins {

android {
namespace = "com.datadog.android.core.integration"
defaultConfig {
minSdk = AndroidConfig.MIN_SDK
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
java17()
}

packaging {
resources {
excludes += listOf(
"META-INF/jvm.kotlin_module",
"META-INF/LICENSE.md",
"META-INF/LICENSE-notice.md"
)
}
}

sourceSets.named("test") {
// Required because AGP doesn't support kotlin test fixtures :/
java.srcDir("${project.rootDir.path}/dd-sdk-android-core/src/testFixtures/kotlin")
buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
testProguardFile("test-proguard-rules.pro")
}
getByName("debug") {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
testProguardFile("test-proguard-rules.pro")
}
}
}

Expand All @@ -38,25 +73,26 @@ dependencies {
implementation(libs.kotlin)

// Testing
testImplementation(project(":tools:unit")) {
androidTestImplementation(project(":tools:unit")) {
attributes {
attribute(
com.android.build.api.attributes.ProductFlavorAttr.of("platform"),
objects.named("jvm")
objects.named("art")
)
}
}
testImplementation(testFixtures(project(":dd-sdk-android-core")))
testImplementation(libs.bundles.jUnit5)
testImplementation(libs.bundles.testTools)
testImplementation(libs.okHttp)
testImplementation(libs.gson)
unmock(libs.robolectric)
}

unMock {
keepStartingWith("android.os")
keepStartingWith("org.json")
androidTestImplementation(project(":reliability:stub-feature"))
androidTestImplementation(libs.assertJ)
androidTestImplementation(libs.mockitoAndroid)
androidTestImplementation(libs.bundles.integrationTests)
androidTestImplementation(libs.elmyrJVM)
androidTestImplementation(libs.okHttp)
androidTestImplementation(libs.okHttpMock)
androidTestImplementation(libs.gson)
if (project.hasProperty(com.datadog.gradle.Properties.USE_API21_JAVA_BACKPORT)) {
// this is needed to make AssertJ working on APIs <24
androidTestImplementation(project(":tools:javabackport"))
}
}

androidLibraryConfig()
Expand Down
7 changes: 7 additions & 0 deletions reliability/core-it/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Needed to make sure we don't remove any test code
-dontshrink
#-dontoptimize
#-keepattributes *Annotation*

-dontwarn kotlin.Experimental$Level
-dontwarn kotlin.Experimental
Loading

0 comments on commit 85fb24b

Please sign in to comment.