3 ms·
Write tests to be deterministic from the very start (mainly: learn to use synchronization primitives to synchronize events rather than trying on timing coincide
by ComputerGuru 7y ago
Write tests to be deterministic from the very start (mainly: learn to use synchronization primitives to synchronize events rather than trying on timing coincidences) and then you'll realize there's no such thing as a flaky test.
- quickthrower2 7y agoHave you written Selenium tests before, pointing to a staging or production build?
- ComputerGuru 7y agoYes, I have and it's IMHO a very poorly designed API (or rather, abstraction) for reproducible tests, but yes, the premise still stands. Instead of crossing your fingers and hoping a navigation has occurred/completed, test deterministically for the current state (inspecting browser navigation state, page url, and window events) to decide whether a certain action can be taken or is valid at the time. Basically, you should build your own framework upon which real tests can be run.