Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
VaderNT16174yYes, I use this a lot, with the equivalent terms "given, when, then". I find that extracting methods that start with these leads to very readable tests. Like givenEmptyAddressBook(), whenAddingContact() etc.
Though you have to refrain from abstracting too much, or readability suffers again. I've had coworkers attempting to create given-when-then builders you pass lambda functions to, in order to "solve this once and for all". You can solve everything with layers of abstraction, except having too many layers of abstraction, as they say. -
VaderNT16174y@uyouthe
> I don’t believe in unit tests lol
Stop writing software like the Wright brothers built airplanes: Cobbling together the whole thing, then pushing it off a cliff to see if it crashes. Would you laugh at wind tunnel testing? I hope not. -
kiki352694y@VaderNT You constructed your sentence just like Wright brothers, but with rough assumptions instead of wood. How ironic
Wouldn’t laugh at wind tunnels but would laugh at you -
VaderNT16174y@uyouthe your reply carries about as far as the Wright's prototypes. Try fueling it with clarification - it's you who said "I don't believe in unit tests lol" which in almost all situations translates to "I'm being unprofessional".
-
kiki352694y@VaderNT if you think not believing in unit tests is being unprofessional, you should probably now be where you belong – under uncle bob’s table, sucking his dick. Sorry, gotta go, CTO job is a busy one.
-
VaderNT16174y@uyouthe waving around Uncle Bob's dick or yours is a lot less impressive than actual arguments. If you had any, you could've easily provided them by now. That speaks for itself.
-
kiki352694y@VaderNT @alexbrooklyn can I convince you two boubas? Yes. Do I care about what you two boubas think? No, not at all.
Having trouble with code quality? Write a lot of tests. And I mean a *lot*. Test every file in isolation. Mock as many imports as possible.
When you're done, your code will still be bad, but now your tests will make sure it's impossible to improve anything in any meaningful way. -
VaderNT16174y@uyouthe
I see you've expanded on this in your rant: https://devrant.com/rants/3006186/...
Thank you. That was a good idea, since this isn't what this rant here is about. So I'll continue on your rant.
I'm a strong believer in the triple-A unit-test pattern: Arrange, Act and Assert
Anyone else that uses this for their tests? Do you see any cons to using this approach to writing tests? Are you using an alternative?
question