How are dependencies dealt with when writing tests?



  • If you have three tests A, B, C and each tests a specific scenario, where B depends on A and C depends on B and A. How do you deal with that? Is it a case where there should not be three tests in the first place, but rather merged into one or are dependencies normal. There are also situations where you have three tests A, B, C and each tests a different scenario but B includes test A and C includes test B and therefore test A. Is this normal or is this best avoided? If it is to be avoided, how should the tests be written?



  • Keeping each test separate, but dependent on each other, may introduce erroneous failures if the prerequisite tests have not completed or have failed. Each test should be independent of another. I would cascade the tests in this example: Test #1 = A Test #2 = A + B Test #3 = A + B + C


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2