Skip to content

Project Testing

Samuel Villaescusa Vinader edited this page Jul 17, 2020 · 1 revision

#### Description I have tried to test almost every line of code in the project. By making use of Mockito and Koin I have also tried to make cleaner tests by having mock objects and needed dependencies.

I have tried to give a BDD aspect to almost every test. It has been a little bit difficult at the begging, as I am more familiar to Rails style with Rspec, but at the end I think it turned out well.

Unit test

I have develop every UnitTest by providing dependencies and trying to mock unnecessary objects.

Something to take care of about Mockito and Kotlin (as Kotlin classes are final by default) -> https://www.baeldung.com/mockito-final#configure-mocktio

To run UnitTest you just need to execute the next command -> ./gradlew testDebugUnitTest

Robolectric test

I have added Robolectric to be able to make Android related tests without the need of putting up an Android Virtual machine.

So at the end is kind of UnitTest and gives me the ability to do TDD in a fastest way for example.

PD: As far as I have been able to read, by the moment Robolectric do not support API 29 or higher, so all the tests are running under API 28.

To run AndroidTests you just need to execute the next command -> ./gradlew testDebugUnitTest

Acceptance test

I have implement two of them, one for the LoginVertical and another one for the Logout. As you can see I have skip Android and Unit testing for the Presentation layer, as I think for the purpose of the test, this is enough testing.

To run those tests you just need to execute -> ./gradlew connectedAndroidTest

Clone this wiki locally