-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
100 lines (83 loc) · 3.46 KB
/
build.gradle
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
88
89
90
91
92
93
94
95
96
97
98
99
100
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1")
}
}
apply plugin: 'com.android.library'
apply plugin: "de.mannodermaus.android-junit5"
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 28
targetSdkVersion 30
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
// JUnit 5 support for instrumentation tests
testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
}
// make the android-test reuse the dependency sources
sourceSets {
// reusing main sources is important for checking compilation compatibility
main {
java.srcDirs = ["../math/src/main/java", "../craco/src/main/java"]
}
// unit tests. Run via test task
test {
java.srcDirs = ["../math/src/test/java", "../craco/src/test/java"]
}
// instrumentation tests. Run via connectedAndroidTest
androidTest {
java.srcDirs = ["../math/src/test/java", "../craco/src/test/java"]
}
}
compileOptions {
setSourceCompatibility(JavaVersion.VERSION_1_8)
setTargetCompatibility(JavaVersion.VERSION_1_8)
}
testOptions {
unitTests {
all {
useJUnitPlatform()
maxParallelForks 4
//we want display the following test events
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
}
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1'
implementation group: 'org.reflections', name: 'reflections', version:'0.9.10'
// (Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.1"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.1"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.7.1"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.13"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.7.1"
// Instrumentation test stuff
androidTestImplementation "androidx.test:runner:1.3.0"
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.7.1"
androidTestImplementation "org.junit.jupiter:junit-jupiter-params:5.7.1"
androidTestImplementation "de.mannodermaus.junit5:android-test-core:1.2.2"
androidTestRuntimeOnly "de.mannodermaus.junit5:android-test-runner:1.2.2"
}