SQLServerCentral Editorial

Test Coverage

,

This editorial was originally published on Nov 12, 2013. It is being re-run as Steve is on holiday.

I've never had to work full time in a QA group, but I have had to perform software testing of an application and it wasn't fun. Even as I worked through the various features, looking for edge cases, common mistakes, etc., I realized that running tests was something that really required more discipline and process than I was giving it at the time. Too often I 'd realize that my regressions weren't 100% duplicates of previous executions because I'd allowed too much "human effort" into my process.

These days most testing of software is automated. I know QA groups still exist, and they need to handle some of the manual checks that are very hard to automate. However more and more testing is being pushed back onto developers to handle, with frameworks like NUnit and JUnit. In the database world, we haven't done a great job of including testing into the code we write, but there's a great testing framework we can use.

TSQLT is a framework written by Sebastian Meine and Dennis Lloyd and it's free. It's been developed to help you write tests that can exercise your T-SQL code to determine if it's doing what you expect. I've used it a little, and while I see the potential, I also realize that this will take some practice to learn how to more easily write tests that can cover the various potential places where bugs can be introduced.

However, if you use version control, and you should, then you can easily spread the load of writing tests to all of your developers. Since the tests are stored procedures, they can be included in your VCS project and shared by all your developers. With a little effort from each member of your team, you might be surprised at the code coverage you can achieve with this framework.

Testing is important, as we see over and over again as software is released and doesn't work as expected. I think much of that is our fault, as software developers, for not improving our testing skills and discipline.

Rate

4 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

4 (1)

You rated this post out of 5. Change rating