I'd just add some nuance to:
> If you cannot reach the untested lines with the public interface of your software, maybe you can just delete those lines. Do not reach for stubs/mocks to achieve 100% test coverage, try to find a scenario of how to run through these branches by using the API from a realistic point of view.
Sometimes you need a few mocks for exceptional situations. You're not going to fill up your disk just to check that ENOSPC, or try to race the test with bringing down an interface to reproduce network timeouts.
I would answer your question by stating your alternative _might_ be an easier test to write now, but amortizing the (already low) cost of having a code written with first practices in mind will be much easier to work with in the long run. Including across small and large teams. Ultimately we want our code to be reliable and scalable, and we can do that by making our code testable and maintainable.
And even then, that’s still a behavior mock, of a kind. There are lots of ways in which a dummy ISO mount behaves much unlike filesystems your deployed code might run on. You could address those issues, but doing so is very laborious and starts requiring more and more specialized code. Unless the code under test is part of a database storage engine or something, it’s likely even less worth it.
For example in flutter, you can check whether a component is visible on the "screen" and simulate an action with it.
No need to ask a human to test the new ui if you can detect that the new button isn't visible on the "screen" .
Then once you know what's supposed to be there is there, a human must test it.
TDD is one of the worst concepts ever concocted by the software industry right up there with UML.
It’s all very ThoughtWorks.
One of the very best things to come out of AI development is the extent to which it sends TDD to the ninth level of hell.