Why Singleton is bad for testing?

Why Singleton is bad for testing?
Answer
While they provide a quick and easy solution, singletons are considered bad because they make unit testing and debugging difficult. … This property allows you to substitute alternate implementations for collaborators during testing to achieve specific testing goals (think mock objects).
 

Tìm kiếm

Back
Top