Issue#94 Grammatical issues: Robolectric
This commit is contained in:
parent
13b27ac9d3
commit
559440884d
1 changed files with 9 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# 5. Starting of Robolectric testing
|
# 5. Starting of Robolectric testing
|
||||||
|
|
||||||
So we are finally here, so far we didn't had to touch any kind of context or resources, activities, fragments or anything Android. This is where we have to get back to reality and actually deal with Android.
|
So we are finally here, so far we didn't have to touch any kind of context or resources, activities, fragments or anything Android. This is where we have to get back to reality and actually deal with Android.
|
||||||
|
|
||||||
In this testing instruction set you will learn how to write simple tests using Robolectric.
|
In this testing instruction set you will learn how to write simple tests using Robolectric.
|
||||||
|
|
||||||
|
|
@ -213,11 +213,11 @@ The line `TestDatabaseInitialization.overwriteDatabaseInitialization(testDispatc
|
||||||
|
|
||||||
> Above min API 24
|
> Above min API 24
|
||||||
> DatabaseInitialization could be overwritten in Test module, by declaring the same class in the same package with the same methods. This is an easy way to switch out an implementation.
|
> DatabaseInitialization could be overwritten in Test module, by declaring the same class in the same package with the same methods. This is an easy way to switch out an implementation.
|
||||||
> That might not look the cleanest, so the presented way of switch out the koin-module creating the database is preferred. In other dependency injection / service locator frameworks this should also be possible.
|
> That might not look the cleanest, so the presented way of switching out the koin-module creating the database is preferred. In other dependency injection / service locator frameworks this should also be possible.
|
||||||
|
|
||||||
### 1. `atTheStartOurDatabaseIsEmpty`
|
### 1. `atTheStartOurDatabaseIsEmpty`
|
||||||
|
|
||||||
Our test is as simple as it gets. We get the observable and it's first element. Then we assert that it is an empty list.
|
Our test is as simple as it gets. We get the observable and its first element. Then we assert that it is an empty list.
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -300,7 +300,7 @@ Assert.assertEquals(expected, actual.getCompleted())
|
||||||
|
|
||||||
Okay, this should be really similar to `addingFavouriteUpdatesExistingObservers` just with a hint of `contentIdAddedThenRemovedCanNoLongerBeReadOut` so try to write it on your own.
|
Okay, this should be really similar to `addingFavouriteUpdatesExistingObservers` just with a hint of `contentIdAddedThenRemovedCanNoLongerBeReadOut` so try to write it on your own.
|
||||||
|
|
||||||
However for completness sake:
|
However for completeness sake:
|
||||||
```kotlin
|
```kotlin
|
||||||
val expected = listOf(listOf(ContentId("a")), listOf())
|
val expected = listOf(listOf(ContentId("a")), listOf())
|
||||||
sut.markAsFavourite(ContentId("a"))
|
sut.markAsFavourite(ContentId("a"))
|
||||||
|
|
@ -516,7 +516,7 @@ fun tearDown() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
> Idling Resources comes from Espresso. The idea is that anytime we want to interact with the UI via Espresso, it will await any Idling Resource beforehand. This is handy, since our Network component, (OkHttp) uses it's own thread pool, and we would like to have a way to await the responses.
|
> Idling Resources comes from Espresso. The idea is that anytime we want to interact with the UI via Espresso, it will await any Idling Resource beforehand. This is handy, since our Network component, (OkHttp) uses its own thread pool, and we would like to have a way to await the responses.
|
||||||
> Disposable is just a syntactic-sugar to remove the OkHttpIdling resource from Espresso when we no longer need it.
|
> Disposable is just a syntactic-sugar to remove the OkHttpIdling resource from Espresso when we no longer need it.
|
||||||
> Idling Resources also make it easy for us, to coordinate coroutines with our network responses, since we can await the IdlingResource and advance the Coroutines afterwards.
|
> Idling Resources also make it easy for us, to coordinate coroutines with our network responses, since we can await the IdlingResource and advance the Coroutines afterwards.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue