3 ms·
In new code, I'll usually write high level black box tests once enough code is in place to start doing something useful. I rarely write unit tests except for be
by AYBABTME 7y ago
In new code, I'll usually write high level black box tests once enough code is in place to start doing something useful. I rarely write unit tests except for behavior that is prone to be badly implemented/refactored, or for stuff that's pretty well isolated and that I know I won't touch for a while.
Then as the project evolves, I start adding more high level tests to avoid regressions.
I prefer high level testing of products, they're more useful since you can use them for monitoring as well, if you do it right. I work with typed languages so there's little value in unit tests in most cases.
Sometimes I'll write a test suite "first", but then again only once I have at least written up a client to exercise the system. Which implies I probably decided to stabilize the API at that point.
Like others have said, tests often turn into a huge burden when you're trying to iterate on designs, so early tests tend to cause worse designs in my opinion, since they discourage architectural iterations.
- xkcdfan001 7y agoUnit tests actually are the most important ones... I do not wanna work on any of your projects heh.
- dillonmckay 7y agoTo each their own. I have seen many times all the unit tests pass, but the application is broken. It really depends on the situation. There is no silver bullet when it comes to testing.
- xkcdfan001 7y agoYeah that's why "every" open source project you trust has a shitload of unit test. For amateurs, no tests, pros write test always.
- deleted 7y ago[deleted]
- EpicEng 7y agoIn my experience, people who run around proclaiming how great they are and calling other people 'amateurs' are the real amateurs. The pros have seen enough to know that there are all sorts of ways to succeed and that (engineering) religion often gets you in trouble.
- hota_mazi 7y agoIf I have time to write only one of unit or functional test, I will always choose a functional test, because these ones test what the user actually sees. It's possible to write an app that passes 100% of unit tests and still be completely broken to the user.