epfl-SDP / android

A repository for the CS-306 Software Development Project class at EPFL.
MIT License
13 stars 2 forks source link

Migrate some integration tests to the unit test source set #204

Open alexandrepiveteau opened 2 years ago

alexandrepiveteau commented 2 years ago

Context

Currently, nearly all of our tests are located in the androidTest source set. Therefore, many tests which could be run as unit tests are executed as integration tests, considerably slowing down the builds. Out of the 250+ tests which we currently have, at least 125 could be run as unit tests.

This issue contains a suggestion of some gradual steps to make the migration as smooth as possible. Each step could be performed in a separate PR, to make the migration process smoother.

Migration path

The final result will be that we have four source sets :

Questions & Answers

Android Studio has an issue where, if you have two files in the same package and with the same name in the main and androidTest source sets, it won't compile properly when you run some integration tests. This is the reason for which we currently have the .test package suffix for our integration tests. However, with the introduction of some additional source sets, it makes sense to better distinguish in the package name tests and code which is meant for integration, unit, or both kinds of tests.

alexandrepiveteau commented 2 years ago

As indicated in #257, it won't be possible to use Robolectric right away to migrate the Compose-based androidTest tests into the test source set.