For those not familiar, JSLint is like that elementary school teacher who enjoyed using their red pen just a little too much when they graded your essays. Except JSLint doesn’t care about mismatched verb tenses or dangling participles– it cares about things like undeclared variables, consistent space indentations and unexpected ‘++’ usage.
Unit testing is like nasal irrigation. Many experts agree it is beneficial, but when the time comes to make it a regular part of your daily routine– everyone suddenly has “more important things to do.”
(Pardon the comparison, but this is the first weekend of spring. I’m under the weather with allergy/sinus troubles– which should explain both the simile above and my current frame of mind.)
(You were wondering if I was going to work that back in, weren’t you?)
I won’t walk you through downloading and installing the QUnit framework, or the obvious tests (e.g. are the default values of the properties what we expect them to be when the object initializes). That’s what the QUnit documentation is for, and I encourage you to read and familiarize yourself with it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Is anyone else trying to add unit testing to their workflow/routine? If so, what tricks have you learned? Let us know in the comments below.
Several years ago, the Oatmeal did a fabulously hilarious poster that showed how a website redesign starts off on the right foot– only to become completely derailed into a horrible abomination by client feedback and endless revisions.
Web Development is more efficient. We don’t let client feedback mess up our code. Instead, we screw it all up by ourselves.
Disclosure: I went through a job search in 2014, and no one asked me to solve the FizzBuzz problem in a job interview. The only reason I’ve heard of it is because it was mentioned on Quora. Personally, I think it sounds condescending and alienating, but it makes a great example of “HOW A SIMPLE ALGORITHM GOES STRAIGHT TO HELL!”