loading...

re: How to convince devs to do more testing VIEW POST

FULL DISCUSSION
 

Sometimes is maybe because testing got appropriated by TDD, if you don't do TDD you're not testing, if you don't TDD you are worthless.

I don't like to write the test before the code, sometimes the whole structure of what I'm coding changes when I'm writing it so to make the same test over and over is awkward to me: maybe something in the current function started to look a lot like some other function I made and now I wasted time testing something twice or writing the code I realize it got some new condition to test that may invalidate the previously made test.

To me is annoying and I see no benefit from it, said that, to me, untested code is as unfinished as not running code, just because it compiles doesn't mean it does what it supposed to, so is not yet working code. Not even in my local repo I ever commit something not tested. Not tested is just a mockup and you don't mix mockup code with working and commited code.

Sadly TDD took over testing so people not liking TDD end up ditching and avoiding testing, why bother, if is not TDD is garbage anyway. It became a credo, something to blindly follow without question, and to attack anyone that don't follow the holy path. Almost like Agile, OOP or Robert Martin. Sacred words.

 

and that is usually boring. :)

 

I like the idea ”not tested is just a mockup.” Similar to Michael Feathers’ definition of “legacy code.”

Testing is a whole bag of tricks and just the mention of TDD can turn someone away from testing entirely, which is unfortunate.

TDD is just a methodology, one of many, suited for some cases and not so much to others; some people feel comfortable with it and write better code because of it, others feel it awkward and cumbersome. TDD is not "the best". There are no recipe to write good code, just some guidelines and advices.

I think some aspects of TDD get too "personal", you can tell your employees what structure the code should have, deadlines, even format and style, but things like when to write the test, the order you make things, to me is too invasive, you are messing with the internal process of the programmer. Who cares if (s)he writes the test first or after, demand a proper test, trying to control the process is micromanaging and nobody appreciate that.

 

I did TDD once - properly. When I was building a cube library. It was a way to translate queries into MDX statements. I tried designing the application, like normal, and kept getting into knots. So I wrote it using TDD, and surprisingly with a bit of refactoring - the library was aweseome.
That was seven years ago and not for a client.
I only really write tests when working through logic or ideas. Very occasionally, if there are calculations or something which was hard to do and would benefit from a test for a developer in the future to view.
It is a strategic/team decision as to whether to have unit tests to help reduce regression fixes and completely agree it isn't something to undertake blindly.

 

Offtopic

I did TDD once - properly.

It sounds like an euphemism, sorry I had to say it, I couldn't help it. :D

Could probably think of funnier euphemisms, but it works. :)

you probably could, but that one, is special, it wasn't planned, came directly from your heart. :]

Code of Conduct Report abuse