Optimizing MagneticRowManagerImplTest by more than 90%
Two optimizations can be done to improve the running time of the Unit tests. First, it is not necessary to fully inflate a real ExpandableNotificationRow backed by a Notification and NotificationEntry to test the logic of its magnetic behavior. Significant improvements are achieved by replacing the rows in the tests with mocks, each with a reference to a testable MagneticRowListener. Second, we can replace the NotificationTargetsHelper dependency with a testable object that allows to set the magnetic targets during test setup. This avoids having to run the target finding algorithm for each test and makes NotificationTargetsHelper more testable. This CL makes NotificationTargetsHelper an interface to achieve this result. Test: NotificationTargetsHelperTest Test: MagneticRowManagerImplTest Test: Verified test run about 90% faster when using atest Bug: 427255241 Flag: NONE improving unit tests Change-Id: Iaa72066e626d571f69af755695bfe4f5d68183a1
Loading
Please register or sign in to comment