Testing · Junior · Question 27 of 78

Why is it useful that each test is independent?

Explanation

Shared mutable state between tests causes order-dependent failures that are hard to debug. Reset state in beforeEach.

Further reading

Problem with a question

Testing · Junior · question 27

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz