Issue#41 Make sharedTests abstract so they won't be run in themself
This commit is contained in:
parent
52a99a82fc
commit
60cfb46ccf
11 changed files with 13 additions and 11 deletions
|
|
@ -24,7 +24,7 @@ import java.io.IOException
|
||||||
* https://developer.android.com/training/data-storage/room/migrating-db-versions
|
* https://developer.android.com/training/data-storage/room/migrating-db-versions
|
||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
open class MigrationToLatestInstrumentedSharedTest : KoinTest {
|
abstract class MigrationToLatestInstrumentedSharedTest : KoinTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val helper = SharedMigrationTestRule<LocalDatabase>(instrumentation = InstrumentationRegistry.getInstrumentation())
|
val helper = SharedMigrationTestRule<LocalDatabase>(instrumentation = InstrumentationRegistry.getInstrumentation())
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.junit.rules.RuleChain
|
||||||
import org.koin.test.KoinTest
|
import org.koin.test.KoinTest
|
||||||
|
|
||||||
@Suppress("TestFunctionName")
|
@Suppress("TestFunctionName")
|
||||||
open class MainActivityInstrumentedSharedTest : KoinTest {
|
abstract class MainActivityInstrumentedSharedTest : KoinTest {
|
||||||
|
|
||||||
private lateinit var activityScenario: ActivityScenario<MainActivity>
|
private lateinit var activityScenario: ActivityScenario<MainActivity>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import org.junit.rules.RuleChain
|
||||||
import org.koin.test.KoinTest
|
import org.koin.test.KoinTest
|
||||||
|
|
||||||
@Suppress("TestFunctionName")
|
@Suppress("TestFunctionName")
|
||||||
open class AuthActivityInstrumentedSharedTest : KoinTest {
|
abstract class AuthActivityInstrumentedSharedTest : KoinTest {
|
||||||
|
|
||||||
private lateinit var activityScenario: ActivityScenario<AuthActivity>
|
private lateinit var activityScenario: ActivityScenario<AuthActivity>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import org.koin.test.KoinTest
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
@Ignore("CodeKata")
|
@Ignore("CodeKata")
|
||||||
@Suppress("EmptyFunctionBlock")
|
@Suppress("EmptyFunctionBlock")
|
||||||
open class CodeKataAuthActivitySharedTest : KoinTest {
|
abstract class CodeKataAuthActivitySharedTest : KoinTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import org.junit.rules.RuleChain
|
||||||
import org.koin.test.KoinTest
|
import org.koin.test.KoinTest
|
||||||
|
|
||||||
@Suppress("TestFunctionName")
|
@Suppress("TestFunctionName")
|
||||||
open class SplashActivityInstrumentedSharedTest : KoinTest {
|
abstract class SplashActivityInstrumentedSharedTest : KoinTest {
|
||||||
|
|
||||||
private lateinit var activityScenario: ActivityScenario<SplashActivity>
|
private lateinit var activityScenario: ActivityScenario<SplashActivity>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ Let's open `org.fnives.test.showcase.ui.login.codekata.CodeKataAuthActivityShare
|
||||||
We can see it's identical as our original `org.fnives.test.showcase.ui.codekata.CodeKataAuthActivityInstrumentedTest`.
|
We can see it's identical as our original `org.fnives.test.showcase.ui.codekata.CodeKataAuthActivityInstrumentedTest`.
|
||||||
So let's copy our existing code from the Robolectric test here. For that we can use the body of `org.fnives.test.showcase.ui.RobolectricAuthActivityInstrumentedTest`.
|
So let's copy our existing code from the Robolectric test here. For that we can use the body of `org.fnives.test.showcase.ui.RobolectricAuthActivityInstrumentedTest`.
|
||||||
|
|
||||||
Of course keep the `open` and the `CodeKataAuthActivitySharedTest` class name and package.
|
Of course keep the `abstract`, the `CodeKataAuthActivitySharedTest` class name and package.
|
||||||
We need to modify our robot:
|
We need to modify our robot:
|
||||||
```kotlin
|
```kotlin
|
||||||
// Instead of this:
|
// Instead of this:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ import java.io.IOException
|
||||||
* https://developer.android.com/training/data-storage/room/migrating-db-versions
|
* https://developer.android.com/training/data-storage/room/migrating-db-versions
|
||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
open class MigrationToLatestInstrumentedSharedTest {
|
@Suppress("UnnecessaryAbstractClass")
|
||||||
|
abstract class MigrationToLatestInstrumentedSharedTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val helper = SharedMigrationTestRule<LocalDatabase>(instrumentation = InstrumentationRegistry.getInstrumentation())
|
val helper = SharedMigrationTestRule<LocalDatabase>(instrumentation = InstrumentationRegistry.getInstrumentation())
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class NetworkSynchronizedActivityTest {
|
@Suppress("UnnecessaryAbstractClass")
|
||||||
|
abstract class NetworkSynchronizedActivityTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var networkSynchronizationHelper: NetworkSynchronizationHelper
|
lateinit var networkSynchronizationHelper: NetworkSynchronizationHelper
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import org.junit.Test
|
||||||
import org.junit.rules.RuleChain
|
import org.junit.rules.RuleChain
|
||||||
|
|
||||||
@Suppress("TestFunctionName")
|
@Suppress("TestFunctionName")
|
||||||
open class AuthActivityInstrumentedSharedTest : NetworkSynchronizedActivityTest() {
|
abstract class AuthActivityInstrumentedSharedTest : NetworkSynchronizedActivityTest() {
|
||||||
|
|
||||||
private lateinit var activityScenario: ActivityScenario<AuthActivity>
|
private lateinit var activityScenario: ActivityScenario<AuthActivity>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.junit.Test
|
||||||
import org.junit.rules.RuleChain
|
import org.junit.rules.RuleChain
|
||||||
|
|
||||||
@Suppress("TestFunctionName")
|
@Suppress("TestFunctionName")
|
||||||
open class MainActivityInstrumentedSharedTest : NetworkSynchronizedActivityTest() {
|
abstract class MainActivityInstrumentedSharedTest : NetworkSynchronizedActivityTest() {
|
||||||
|
|
||||||
private lateinit var activityScenario: ActivityScenario<MainActivity>
|
private lateinit var activityScenario: ActivityScenario<MainActivity>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import org.junit.Test
|
||||||
import org.junit.rules.RuleChain
|
import org.junit.rules.RuleChain
|
||||||
|
|
||||||
@Suppress("TestFunctionName")
|
@Suppress("TestFunctionName")
|
||||||
open class SplashActivityInstrumentedSharedTest : NetworkSynchronizedActivityTest() {
|
abstract class SplashActivityInstrumentedSharedTest : NetworkSynchronizedActivityTest() {
|
||||||
|
|
||||||
private lateinit var activityScenario: ActivityScenario<SplashActivity>
|
private lateinit var activityScenario: ActivityScenario<SplashActivity>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue