Starting from a question on LinkedIn:
what’s the best practice for automated testing of functionality that is inherently time dependent? A contrived example might be testing the navigation key-repeat functionality of a video streaming device; where I want to verify that - over a 5 second press - I’ve generated a specific number of navigation movement events, or the repeat period has reduced to a specific time (accelerating the movement as the key is held).
I recommend testing only the business logic for a single event. You may use your E2E tests to verify that the scheduler works as expected.
Actually, this is a good idea that extends beyond just testing. It has influenced how I think about system architecture quite a lot.
Absolutely. Including testability between the requirements promotes simplicity in both the design and implementation. It’s cheaper to put in extra effort and keep things simple, compared to testing a complex system.