Non-independent Tests vs Cypress

S Chathuranga Jayasinghe
4 min readNov 4, 2023

Of course, the best practices state that, each test should be independent! But..

Test automation is a cornerstone of modern software development, offering efficiency, consistency, and speed in the testing process. However, not all tests are created equal, and one of the challenges that often arises is dealing with non-independent tests.

As a SDET with over 9 years of experience, I’ve encountered this more often. Though the Cypress best practices too mention that each test should be independent, at some points we have to break this practice.

Understanding Non-Independent Tests:

Non-independent tests, are tests that are interrelated or dependent on each other in some way. This means the outcome of one test can affect the success or failure of another. These dependencies can manifest in various forms, such as:

  1. Shared State: Tests that rely on a shared state or data can be affected by changes made by previous tests. For example, if one test modifies a database record, subsequent tests that depend on that record may fail.
  2. Execution Order: Some tests may rely on a specific execution order, where one test must run before others. If the order is disrupted, it can lead to failures.
  3. Resource Availability: Tests that require specific resources, like network connections or hardware devices, can be affected if those resources are not available or are in use by other tests.

--

--