@@ -9,32 +9,36 @@ A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] unit tests
9
9
``` groovy
10
10
buildscript {
11
11
dependencies {
12
- classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.0-M6 "
12
+ classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3-rev1 "
13
13
}
14
14
}
15
15
```
16
16
17
17
Snapshots of the development version are available through [ Sonatype's ` snapshots ` repository] [ sonatyperepo ] .
18
18
19
- ** Note** : This plugin also supports the Release Candidates of JUnit 5.
20
- However, as of Android Studio 3.0 Beta 5, there is an internal issue with how tests are executed from the IDE
21
- related to a removed API in JUnit 5 still accessed from Android Studio's build of IntelliJ.
22
- If you run your JUnit 5 tests directly from Android Studio * right now* , they will fail with a ` NoSuchMethodError ` .
23
-
24
- If you are running the latest version of IDEA itself, or you only ever run tests from the command line,
25
- it's safe to upgrade this plugin to the * actual* most recent version, ` 1.0.0-RC3 ` .
26
-
27
19
## Setup
28
20
29
21
``` groovy
30
22
apply plugin: "com.android.application"
31
23
apply plugin: "de.mannodermaus.android-junit5"
32
24
33
25
dependencies {
34
- testApi junitJupiter ()
26
+ testImplementation junit5 ()
35
27
36
28
// (Optional) If you need "parameterized tests"
37
- testApi junitParams()
29
+ testImplementation junit5Params()
30
+
31
+ // For Android Studio users:
32
+ //
33
+ // All versions up to and including AS 3.0 Beta 5 use a build of IntelliJ IDEA
34
+ // that depends on APIs of an outdated Milestone Release of JUnit 5.
35
+ // Therefore, your tests will fail with a NoSuchMethodError
36
+ // when executed from Android Studio directly.
37
+ //
38
+ // To prevent this, there is a separate library you can apply here.
39
+ // It provides a copy of the JUnit 5 Runtime used in a more recent build
40
+ // of IntelliJ, overriding the one embedded in Android Studio.
41
+ testCompileOnly "de.mannodermaus.gradle.plugins:android-junit5-embedded-runtime:1.0.0-RC3-rev1"
38
42
}
39
43
```
40
44
@@ -55,9 +59,9 @@ However, there are some additional properties that you can apply:
55
59
``` groovy
56
60
junitPlatform {
57
61
// The JUnit Jupiter dependency version to use; matches the platform's milestone by default
58
- jupiterVersion "5.0.0-M6 "
62
+ jupiterVersion "5.0.0-RC3 "
59
63
// The JUnit Vintage Engine dependency version to use; matches the platform's milestone by default
60
- vintageVersion "4.12.0-M6 "
64
+ vintageVersion "4.12.0-RC3 "
61
65
}
62
66
```
63
67
0 commit comments