Independent: The Third Quality of Valuable Tests
Explore the principle of test independence in Rails testing to ensure your test suite produces consistent results no matter the order tests run. Learn to identify and fix dependencies caused by global data or test order, improving test reliability and isolating failures to specific code areas. This lesson equips you with strategies like random test ordering and RSpec bisect to maintain high-quality, maintainable tests.
We'll cover the following...
Independent
A test is independent if it doesn’t depend on any other tests or external data to run. An independent test suite gives the same results no matter how the tests are run and limits the scope of test failures to only tests that cover a buggy method.
Tests order
In contrast, a very dependent test suite could trigger failures throughout our tests from a ...