Unit Test

  • To Test or Not To Test: Unit Testing and Privacy

    ·

    Determining which methods in your application needed testing used to be easy – test everything exposed by the public API. But once you invite other developers to contribute, you are exposing a whole other set of internal APIs to the team. The behavioral consistency of these methods is just as important as that of the…

    Read More

  • Making Singletons Safe in PHP

    ·

    Last time, I argued in favor of the Singleton pattern in WordPress.  Singletons make sense in WordPress specifically for several reasons: They live in the global scope without using the already abused/overused [cci]global[/cci] keyword As a distributed application maintained by several hundred developers, they prevent problems that likely arise from others misusing your code But

    Read More

  • Start with a Unit Test

    ·

    Not everyone is a fan of test-driven development. Writing unit tests for your code can be a laborious task, and it has no immediate benefit to your customers.  So why waste any time writing the tests, right? This past week, a colleague of mine summed up the problem pretty well: I’ve finished writing the code for that

    Read More

  • Dependency Injection and Abstract Interfaces in C#

    ·

    If you’ve ever written code, you’ve probably written a unit test.  If you haven’t written unit tests, you should start. Now. Really. Unit tests let you quickly verify that your code is operating in a predictable fashion.  When you make changes down the road, you re-run the same unit tests to make sure nothing broke.

    Read More