@@ -13,35 +13,80 @@ Furthermore, this repository provides a small showcase of the functionality prov
1313
1414## Download
1515
16- ``` groovy
17- buildscript {
18- dependencies {
19- classpath "de.mannodermaus.gradle.plugins:android-junit5:1.3.1.1"
16+ <details open >
17+ <summary >Groovy</summary >
18+
19+ ``` groovy
20+ buildscript {
21+ dependencies {
22+ classpath "de.mannodermaus.gradle.plugins:android-junit5:1.3.1.1"
23+ }
2024 }
21- }
22- ```
25+ ```
26+ </details >
27+
28+ <details >
29+ <summary >Kotlin</summary >
30+
31+ ``` kotlin
32+ buildscript {
33+ dependencies {
34+ classpath(" de.mannodermaus.gradle.plugins:android-junit5:1.3.1.1" )
35+ }
36+ }
37+ ```
38+ </details >
2339
40+ <br />
2441Snapshots of the development version are available through [ Sonatype's ` snapshots ` repository] [ sonatyperepo ] .
2542
2643## Setup
2744
28- ``` groovy
29- apply plugin: "de.mannodermaus.android-junit5"
45+ < details open >
46+ < summary >Groovy</ summary >
3047
31- dependencies {
32- // (Required) Writing and executing Unit Tests on the JUnit Platform
33- testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.1"
34- testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1"
48+ ``` groovy
49+ apply plugin: "de.mannodermaus.android-junit5"
3550
36- // (Optional) If you need "Parameterized Tests"
37- testImplementation "org.junit.jupiter:junit-jupiter-params:5.3.1"
51+ dependencies {
52+ // (Required) Writing and executing Unit Tests on the JUnit Platform
53+ testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.1"
54+ testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1"
3855
39- // (Optional) If you also have JUnit 4-based tests
40- testImplementation "junit:junit:4.12"
41- testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.3.1"
42- }
43- ```
56+ // (Optional) If you need "Parameterized Tests"
57+ testImplementation "org.junit.jupiter:junit-jupiter-params:5.3.1"
58+
59+ // (Optional) If you also have JUnit 4-based tests
60+ testImplementation "junit:junit:4.12"
61+ testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.3.1"
62+ }
63+ ```
64+ </details >
65+
66+ <details >
67+ <summary >Kotlin</summary >
68+
69+ ``` kotlin
70+ plugins {
71+ id(" de.mannodermaus.android-junit5" )
72+ }
73+
74+ dependencies {
75+ // (Required) Writing and executing Unit Tests on the JUnit Platform
76+ testImplementation(" org.junit.jupiter:junit-jupiter-api:5.3.1" )
77+ testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.3.1" )
4478
79+ // (Optional) If you need "Parameterized Tests"
80+ testImplementation(" org.junit.jupiter:junit-jupiter-params:5.3.1" )
81+
82+ // (Optional) If you also have JUnit 4-based tests
83+ testImplementation(" junit:junit:4.12" )
84+ testRuntimeOnly(" org.junit.vintage:junit-vintage-engine:5.3.1" )
85+ }
86+ ```
87+ </details >
88+
89+ <br />
4590More information on Getting Started can be found [ on the wiki] [ wiki-gettingstarted ] .
4691
4792## Requirements
@@ -54,29 +99,59 @@ The latest version of this plugin requires:
5499
55100There is experimental support for Android instrumentation tests, which requires some additional configuration & dependencies. Note that since JUnit 5 is built on Java 8 from the ground up, these libraries require you to have a ` minSdkVersion ` of at least ` 26 ` . It's recommended to use a product flavor for experimentation if you want to keep your global requirements below ` 26 ` . Check the sample for how this can be done!
56101
57- To start writing instrumentation tests with JUnit Jupiter, add the following to your ` build.gradle ` :
58-
59- ``` groovy
60- android {
61- deaultConfig {
62- // (Required) Make sure to use the AndroidJUnitRunner, of a subclass of it
63- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
64- // (Required) Connect JUnit 5 to the runner
65- testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
102+ To start writing instrumentation tests with JUnit Jupiter, add the following to your module's build script:
103+
104+ <details open >
105+ <summary >Groovy</summary >
106+
107+ ``` groovy
108+ android {
109+ deaultConfig {
110+ // (Required) Make sure to use the AndroidJUnitRunner, of a subclass of it
111+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
112+ // (Required) Connect JUnit 5 to the runner
113+ testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
114+ }
66115 }
67- }
68- dependencies {
69- // (Required) Writing tests for JUnit Jupiter
70- androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.3.1"
71- // (Required) The instrumentation test companion library
72- androidTestImplementation "de.mannodermaus.junit5:android-instrumentation-test:0.2.2"
73-
74- // (Required) Runtime dependencies to orchestrate the execution on-device
75- androidTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1"
76- androidTestRuntimeOnly "org.junit.platform:junit-platform-runner:1.3.1"
77- androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2"
78- }
79- ```
116+ dependencies {
117+ // (Required) Writing tests for JUnit Jupiter
118+ androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.3.1"
119+ // (Required) The instrumentation test companion library
120+ androidTestImplementation "de.mannodermaus.junit5:android-instrumentation-test:0.2.2"
121+
122+ // (Required) Runtime dependencies to orchestrate the execution on-device
123+ androidTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1"
124+ androidTestRuntimeOnly "org.junit.platform:junit-platform-runner:1.3.1"
125+ androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2"
126+ }
127+ ```
128+ </details >
129+
130+ <details >
131+ <summary >Kotlin</summary >
132+
133+ ``` groovy
134+ android {
135+ deaultConfig {
136+ // (Required) Make sure to use the AndroidJUnitRunner, of a subclass of it
137+ testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
138+ // (Required) Connect JUnit 5 to the runner
139+ testInstrumentationRunnerArgument("runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder")
140+ }
141+ }
142+ dependencies {
143+ // (Required) Writing tests for JUnit Jupiter
144+ androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1")
145+ // (Required) The instrumentation test companion library
146+ androidTestImplementation("de.mannodermaus.junit5:android-instrumentation-test:0.2.2")
147+
148+ // (Required) Runtime dependencies to orchestrate the execution on-device
149+ androidTestRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1")
150+ androidTestRuntimeOnly("org.junit.platform:junit-platform-runner:1.3.1")
151+ androidTestRuntimeOnly("de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2")
152+ }
153+ ```
154+ </details >
80155
81156# Migration from 1.0.x
82157
@@ -109,4 +184,4 @@ See also the [full License text](LICENSE).
109184 [ sampletests ] : sample/src/test
110185 [ wiki-dsl ] : https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL
111186 [ wiki-migration ] : https://github.com/mannodermaus/android-junit5/wiki/Migrating-from-1.0.x
112- [ wiki-gettingstarted ] : https://github.com/mannodermaus/android-junit5/wiki/Getting-Started
187+ [ wiki-gettingstarted ] : https://github.com/mannodermaus/android-junit5/wiki/Getting-Started
0 commit comments