4 ms·
Fault injection is much easier if you can mock IO. And you aren't really testing your software if you're not injecting faults.
by Arch-TK 1y ago
Fault injection is much easier if you can mock IO. And you aren't really testing your software if you're not injecting faults.
- ozgrakkurt 1y agoMy point is, you can give gibberish data to a processing function if it just takes in-memory data instead of being parameterized by “IO”. If you parameterize everything by IO then you have to mock the IO
- Arch-TK 1y agoIt's not just about gibberish data. It's read failures, write failures, open failures, for a variety of reasons including permission errors, disk errors, space errors, etc. You basically want to test your code does something sensical with either every possible combination of errors, or with some random subset of combinations of errors. This can be automated and can verify the behaviour of your program in the edge cases. It's actually not usually that helpful to only test "we read corrupt garbage from the file" which is the thing you're describing here.