You are viewing a single comment's thread.

view the rest of the comments →

0
1

[–] sparkybear 0 points 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.

0
0

[–] 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.

0
1

[–] sparkybear 0 points 1 point (+1|-0) ago 

Yeah. Where I'm working we have one dev who is adamant about it, but he's come from some really old school code shops and worked in large corporations. it seems like these huge enterprise solutions would require a lot of testing to ensure that things are functioning properly.

0
0

[–] 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.

0
0

[–] sparkybear ago 

I've never heard of writing unit tests in the same file either. I've always seen them done in a separate file. Usually you're working on "person" and have "persontests". Maybe that's my inexperience though.