Refactoring - Testable code, simplify existing unit tests, enhance test coverage
- Mentors
- Christian Schindler, Annemarie
- Organization
- Catrobat
Theres about 1100+ occurences of “.getInstance()” methods accessing singletons from all over the project. (eg. ProjectManager, StorageHandling, Backpack, SensorManager, etc.) Most of those “God Objects” sometimes exceeding 2000+ LOC, and having way too many responsibilities and functionality, therefore pose a major problem for testing. Lots of business logic is currently untested, or tested via UI since so many of those nearly unmockable God Objects are used there. To remedy this, those classes should be broken up into smaller classes with a clearly defined responsibilities, as well as their usages reevaluated and refactored as well. Existing unit tests are to be refactored and new tests of formerly hard to test parts are to be written. A good example is the Formula object in catrobat, since it is pure business logic, but currently calls a number of singletons and needs a context which can be refactored quite easily and have unit tests put in place.