Hacker Newsnew | past | comments | ask | show | jobs | submit | dogweather's favoriteslogin

> > Functions that do IO are difficult or impossible to test.

> Absolutely not, IO functions are not harder to test than regular ones. Is your function creating a file? Start your test, assert the file doesn't exist, call your function, assert your file exists. Done.

They are harder to test (although definitely not impossible). What if your function does a network request, and the result is highly dependent on latency etc, sure you can mock an endpoint that responds with the various properties desired, but it's much harder than just using Quickcheck or HUnit or one of the other testing libraries.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: