Mock the File System

uttu
1 Min Read


It happens quite often that our applications need to interact with the file system.  As a result, some components inevitably depend on it. When we test such code, we face a choice: mock the file system, or test against the real one?  

There are several opposing views on this. Most developers avoid using the file system in unit tests. Tests that touch the disk are usually treated as an anti‑pattern because they are slow and brittle.

Share This Article
Leave a Comment