-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathbuild.gradle.kts
87 lines (68 loc) · 2.46 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id("com.android.application")
kotlin("android")
id("jacoco")
id("de.mannodermaus.android-junit5").version(Artifacts.Plugin.latestStableVersion)
}
val javaVersion = JavaVersion.VERSION_11
android {
namespace = "de.mannodermaus.junit5.sample"
compileSdk = Android.compileSdkVersion
defaultConfig {
applicationId = "de.mannodermaus.junit5.sample"
minSdk = Android.sampleMinSdkVersion
targetSdk = Android.targetSdkVersion
versionCode = 1
versionName = "1.0"
// Make sure to use the AndroidJUnitRunner (or a sub-class) in order to hook in the JUnit 5 Test Builder
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// These two lines are not needed for a normal integration;
// this sample project disables the automatic integration, so it must be done manually
testInstrumentationRunnerArguments["runnerBuilder"] = "de.mannodermaus.junit5.AndroidJUnit5Builder"
testInstrumentationRunnerArguments["configurationParameters"] = "junit.jupiter.execution.parallel.enabled=true,junit.jupiter.execution.parallel.mode.default=concurrent"
buildFeatures {
buildConfig = true
}
buildConfigField("boolean", "MY_VALUE", "true")
testOptions {
animationsDisabled = true
}
}
// Add Kotlin source directory to all source sets
sourceSets.forEach {
it.java.srcDir("src/${it.name}/kotlin")
}
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
kotlinOptions {
jvmTarget = javaVersion.toString()
}
}
junitPlatform {
// Configure JUnit 5 tests here
filters("debug") {
excludeTags("slow")
}
// Using local dependency instead of Maven coordinates
instrumentationTests.enabled = false
}
tasks.withType<Test> {
testLogging.events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
dependencies {
implementation(libs.kotlinStdLib)
testImplementation(libs.junitJupiterApi)
testImplementation(libs.junitJupiterParams)
testRuntimeOnly(libs.junitJupiterEngine)
androidTestImplementation(libs.junit4)
androidTestImplementation(libs.androidXTestRunner)
// Android Instrumentation Tests wth JUnit 5
androidTestImplementation(libs.junitJupiterApi)
androidTestImplementation(libs.junitJupiterParams)
androidTestImplementation(libs.espressoCore)
androidTestImplementation(project(":core"))
androidTestRuntimeOnly(project(":runner"))
}