Anon Archived Does Voat not unit test or is it just not included in the GitHub repo? (github.com)
submitted ago by 225485?
Posted by: 225485?
Posting time: 5.4 years ago on
Last edit time: never edited.
Archived on: 2/12/2017 1:51:00 AM
Views: 991
SCP: 19
20 upvotes, 1 downvotes (95% upvoted it)
Anon Archived Does Voat not unit test or is it just not included in the GitHub repo? (github.com)
submitted ago by 225485?
view the rest of the comments →
[–] TheGuyWithFace 0 points 1 point 1 point (+1|-0) ago (edited ago)
But they very much do exist. It takes a fair amount of forethought - you have to design your system ahead of time to be modular and think about these things as you go, but good, non-brittle unit tests absolutely exist. If you're having to mock everything every time you write a unit test, that's probably a sign your code could use some refactoring.
[–] sparkybear 0 points 1 point 1 point (+1|-0) ago
I get the importance of some unit tests. But I don't think that they need to be done for everything. I don't agree with justletmevoat, but I also don't agree that we always need them. I think they are good for specific tasks that require either a lot of validation with a lot of moving parts, but I don't see them being useful for smaller things. Maybe because I haven't really done test-driven development, but the way I've seen them implemented in most cases seems like a waste of time.
[–] TheGuyWithFace ago
Oh certainly, I don't think unit tests belong everywhere. I mainly see them as useful for logic-heavy business rules that you know are going to be used for years to come. I can't really comment on TDD, I haven't done much of that either.
[–] boater ago (edited ago)
They are not so bad if you are doing modular functional programming and write your test functions as pure boolean functions accepting no arguments in the same file as the code they are testing. Then you can do a small amount of meta programming by writing a program to parse the function signatures of each module, build a list of your unit test signatures, and write them out to a new code file which prints their name and calls all of them in order, raising an error if any of them do not return True or 1. This reduces a lot of overhead associated with maintaining working unit tests. If you write your tests in the same file as the code they are testing, you won't accidentally loose any of them when a file gets renamed or moved.