1. 2
  1.  

  2. 5

    I know someone who got fired b/c they spent time writing tests. And although some may say, hey, I’d never want to work for a firm that does X, Y or Z anyway, well, I just wanted to point out that situations are out there where testing isn’t moving fast enough. Shipping fast is a huge priority for a lot of shops, etc.

    1. 1

      I also know someone who got fired for not writing tests, so I’m not sure this is really a valid argument. It does mean that if someone believes that writing tests is the best way to ship, then they should make sure that the organization that they join also believes that, and vice-versa.

    2. 3

      Gripe with the article: as an example of a unit test, they gave

      it('should add numbers', () => {
        const expected = 15;
        const actual = add(1, 2, 3, 4, 5);
      
        expect(actual).to.equal(expected); // true
      });
      

      The problem is that example is pretty removed from any real-world use case. It works as an example of what unit testing is, but it’s a bad choice in an article called “No excuses, write unit tests”. If I showed that example to someone and said “look at this, no excuses, write unit tests”, a perfectly reasonable response would be “So what? I can tell by looking at it that my add function is correct.”

      If you’re trying to convince someone that unit tests are worthwhile, testing your add function isn’t going to do anything. You want an example that replicates a real-world situation where unit tests are obviously helpful. Unfortunately, it’s a lot harder to come up with those examples and represent them clearly.

      1. 1

        Completely agree that the example is not going to motivate anyone, but there’s so much open source code with real-world tests that could have been used instead that the author may as well have left out the example entirely.