The Three Laws of Business

No freebies. No backsies. GTFO.

You Nit Tests

with one comment

People that have discovered unit tests for the first time act like little retarded Timmy in a candy store. Developers that have decided they deserve the title of “Senior” discover the joys of the percent-coverage metric. Surely full coverage will make up for them sucking at coding!

Like my Waffle House hash browns…

“We have 98% test coverage!” exclaimed the Senior Developer, with a smug expression on his face. His manager looked as proud as Timmy getting a participation certificate. I think they expected me to immediately kneel down and fellate them in awe, which I didn’t.

Taking a look over their test fixtures, it was pretty clear the tests had been written after the fact. Most of them were along the lines of “No Exception = Pass”. Some of them asserted some blatantly wrong results. Ninety-eight percent coverage and ninety-eight percent useless.

Hint: Writing your fucking tests to check the result is the same as what your first attempt outputted is going to ensure your results stay wrong.

Ensure_Adding_One_To_One_Results_In_Two()

Senior Dev, probably because he felt too important to do some useful work, had written some laughable Official Coding Standards. Part of this stressed the goal of “100% Test Coverage LOL” – and decreed that every goddamn property would be tested.

Here we are testing basic features of the CLR, using the CLR. Set the property, get the property, call Assert.Equals. Might as well stick in a few Adding One To One Results In Two tests while you are at it. If the platform is that retarded then it might well go like this:

3laws: Hey Timmy, can you remember the number 7 for me? Now can you press this big red exception button if the number you are remembering is different to 7?
Timmy: I like puppies!

For my sanity, please

Again, if you don’t know how to use a tool, put it down and walk away. Or at least take a step back and ask “Why am I doing this?”. Some pretentious fuckwad blogging about how your test coverage metric is linked directly to your epenis is not a good enough reason.

Still, I’m happy enough to get paid my consultancy rate to write unit tests for all my properties. Who am I to argue with the Official Standards if it makes it easier to do my job while drunk?

Advertisements

Written by 3laws

January 6, 2009 at 2:11 am

Posted in Uncategorized

One Response

Subscribe to comments with RSS.

  1. […] Test moi ça ! – « Encore une fois, si tu ne sais pas te servir d’un outil, pose le par terre et va t’en. Ou au minimum, recule d’un pas et demande toi pourquoi tu es en train de t’infliger ça » […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: