• Steve Jones - SSC Editor (4/24/2015)


    Good to see some of you doing code reviews. Not a lot of response, so I suspect many aren't.

    Those of you doing testing as well, we'd love to hear more, or get articles on the ways in which you test specific code items. More examples are always helpful to guide others.

    When it comes to testing, I unit test everything I do. SQL is very good for unit testing piece by piece. Like most, I start by writing as much as I can in my rough draft on the request. Then I go back and unit test each section of my code to ensure that every unit is working as expected. Then I start optimizing my code based on those unit tests to ensure I'm at least following some best practices learned from my own resources like books, guides and even the great people of this forum.

    I know that I'm not the best and that I'm not perfect. I'm not trying to be perfect. I'm trying to get stuff done and stuff done that's not going to through wrenches into the engine through each unit I test.

    The next set of tests I sometimes do include is trying to measure the impact of my final product on the server. I want to ensure that my unit testing holistically is paying off and If I need to continue optimizing my query some more. Being I work with large data sets that include big reads of millions, sometimes hundreds of millions of records, I can really bring the pain to the server if I'm not careful, especially with attribution reporting.

    Then lastly, being I mostly do a lot of reporting specific queries, I hand off the final product to a co-worker who will check and ensure the business logic is what they want. The last thing I want to do is flub up the output where we I'm outputting incorrect numbers that cause the team to make incorrect assumptions about the data. This could cost me my job or cost us business if I'm not 120% correct.

    So, yeah, the thought of no testing would kill me. I would likely walk away from a project that did not take testing seriously enough to sanity check my work.