From 0e3acfcd9467060c9ae056a715c777516c7d12e8 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Wed, 29 Jul 2020 15:59:16 -0700 Subject: [PATCH] Move config to robolectric.properties --- .../helpers/FenixRobolectricTestRunner.kt | 19 +++++++------------ app/src/test/resources/robolectric.properties | 3 ++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestRunner.kt b/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestRunner.kt index 76d1b8e9a..37f5f4757 100644 --- a/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestRunner.kt +++ b/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestRunner.kt @@ -5,12 +5,12 @@ package org.mozilla.fenix.helpers import org.robolectric.RobolectricTestRunner -import org.robolectric.annotation.Config /** - * A test runner that starts Robolectric with our custom configuration for use in unit tests. This - * should ALWAYS be used instead of RobolectricTestRunner and AndroidJUnit4. You should only use - * Robolectric when necessary because it non-trivially increases test duration. + * A test runner that was added to start Robolectric with our custom configuration for use in unit tests. + * + * This class is now deprecated as the configuration is set by robolectric.properties instead. + * You should only use Robolectric when necessary because it non-trivially increases test duration. * * usage: * ``` @@ -29,12 +29,7 @@ import org.robolectric.annotation.Config * We chose the name RobolectricTestRunner because we want folks to know they're starting Robolectric * because it increases test runtime. Furthermore, the naming of 3) is unclear so we didn't want to * use that name. + * + * As a result, new tests should use RobolectricTestRunner. */ -class FenixRobolectricTestRunner(testClass: Class<*>) : RobolectricTestRunner(testClass) { - - override fun buildGlobalConfig(): Config { - return Config.Builder() - .setApplication(FenixRobolectricTestApplication::class.java) - .build() - } -} +class FenixRobolectricTestRunner(testClass: Class<*>) : RobolectricTestRunner(testClass) diff --git a/app/src/test/resources/robolectric.properties b/app/src/test/resources/robolectric.properties index 89a6c8b4c..e341e6bfb 100644 --- a/app/src/test/resources/robolectric.properties +++ b/app/src/test/resources/robolectric.properties @@ -1 +1,2 @@ -sdk=28 \ No newline at end of file +sdk=28 +application=org.mozilla.fenix.helpers.FenixRobolectricTestApplication