diff --git a/README.md b/README.md index 7063de8..9ccd47a 100644 --- a/README.md +++ b/README.md @@ -170,5 +170,59 @@ Open the [shared tests instruction set](./codekata/sharedtests.instructionset.md In this section we will see how can we share Robolectric test source with AndroidTests to run our same tests on actual device. We will also see how to write AndroidTest End to End Tests. + +## Util classes + +Additional modules have been added prefixed with test-util. + +These contain all the reusable Test Util classes used in the showcase. + +The Testing setup is extracted into a separate gradle script, which with some modifications, you should be able to easily add to your own project. + +To use the TestUtil classes, you will need to add the GitHub Repository as a source for dependencies: + +```groovy +// top level build.gradle +allprojects { + repositories { + // ... + maven { + url "https://maven.pkg.github.com/fknives/AndroidTest-ShowCase" + credentials { + username = project.findProperty("GITHUB_USERNAME") ?: System.getenv("GITHUB_USERNAME") + password = project.findProperty("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN") + } + // https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token + } + } +} +// OR +// top level build.gradle.kts +allprojects { + repositories { + // ... + maven { + url = uri("https://maven.pkg.github.com/fknives/AndroidTest-ShowCase") + credentials { + username = extra.properties["GITHUB_USERNAME"] as String? ?: System.getenv("GITHUB_USERNAME") + password = extra.properties["GITHUB_TOKEN"] as String? ?: System.getenv("GITHUB_TOKEN") + } + // https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token + } + } +} +``` + +*Latest version:*![Latest release](https://img.shields.io/github/v/release/fknives/AndroidTest-ShowCase) + +and then you can use the following dependencies: +```groovy +testImplementation "org.fnives.android.testutil:android-unit-junit5:" // test-util-junit5-android +testImplementation "org.fnives.android.testutil:shared-robolectric:" // test-util-shared-robolectric +testImplementation "org.fnives.android.testutil:android:" // test-util-android +androidTestImplementation "org.fnives.android.testutil:android:" // test-util-android +androidTestImplementation "org.fnives.android.testutil:shared-android:" // test-util-shared-android +``` + ## License [License file](./LICENSE) diff --git a/app/build.gradle b/app/build.gradle index 15a4ea3..d5da099 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -106,17 +106,13 @@ dependencies { androidTestImplementation project(':mockserver') + testImplementation project(':test-util-junit5-android') + testImplementation project(':test-util-shared-robolectric') + testImplementation project(':test-util-android') + androidTestImplementation project(':test-util-android') + androidTestImplementation project(':test-util-shared-android') + testImplementation testFixtures(project(':core')) -// testImplementation project(':test-util-junit5-android') - testImplementation "org.fnives.android.testutil:android-unit-junit5:1.0.0" androidTestImplementation testFixtures(project(':core')) -// testImplementation project(':test-util-shared-robolectric') - testImplementation "org.fnives.android.testutil:shared-robolectric:1.0.0" -// androidTestImplementation project(':test-util-shared-android') - androidTestImplementation "org.fnives.android.testutil:shared-android:1.0.0" -// testImplementation project(':test-util-android') - testImplementation "org.fnives.android.testutil:android:1.0.0" -// androidTestImplementation project(':test-util-android') - androidTestImplementation "org.fnives.android.testutil:android:1.0.0" }