GSoC2024 - Replacing looseSignatures - Project proposal
- Mentors
- Michael Hoisie
- Organization
- Robolectric
- Technologies
- android, instrumentation, bytecode, Robolectric, apt, Unit Test
- Topics
- optimization, Test fixture
Robolectric is a unit testing framework for Android, which supports running Android tests in JVM instead of physical device or emulator. Robolectric works by both calling into real Android java classes and optionally delegating to functions of shadow(s).
When defining a shadow, Robolectric allows the use of looseSignatures to “when an exact method signature match isn't found, Robolectric will look for a method with the same name but with all argument types replaced with java.lang.Object.”.
looseSignatures has been working well in Robolectric framework for years, however it has its own downsides, such as error-prone, cumbersome.
In this proposal, I plan to 1) Deprecate the usage of looseSignatures, add WithType
2) Adapt Robolectric Annotation Processor (RAP) module to utilize @WithType annotation