A great article about this is Singletons are Pathological Liars. This describes, using a simple example, why testing using singletons is unexpectedly hard.
More Related Contents:
- Unit testing with singletons
- What is Mocking?
- Is Unit Testing worth the effort? [closed]
- Unit Testing DbContext
- What’s the difference between unit tests and integration tests? [duplicate]
- What is the purpose of mock objects?
- What is unit testing and how do you do it? [duplicate]
- What are the differences between unit tests, integration tests, smoke tests, and regression tests? [closed]
- How to Unit Test React-Redux Connected Components?
- Does Selenium support headless browser testing?
- Fill os.Stdin for function that reads from it
- Random data in Unit Tests?
- Is UnitOfWork and GenericRepository Pattern redundant In EF 4.1 code first?
- How to test my servlet using JUnit
- Using different classloaders for different JUnit tests?
- Junit5 mock a static method
- Run JUnit tests with SBT
- To test a custom validation angularjs directive
- Is it bad practice to have more than one assertion in a unit test? [closed]
- Service mocked with Jest causes “The module factory of jest.mock() is not allowed to reference any out-of-scope variables” error
- What is the best way to unit-test SLF4J log messages?
- How to unit test a Go Gin handler function?
- Is there an easy way to stub out time.Now() globally during test?
- Unit testing a method that calls another method
- Example invalid utf8 string?
- Dependency Injection: Turtles all the way down?
- How to do TDD and unit testing in powershell?
- Testing route configuration in ASP.NET WebApi
- how do I mock sqlconnection or should I refactor the code?
- When is a Test not a Unit-test?