Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Currently the way we do this on LedgerSMB is to have SQL scripts which insert records into a test results table. This table is created in a transaction which runs the tests, and the tests always roll back. A wrapper program in Perl runs these scripts, checks the results of the test_result table, and reports errors back up to the test harness. There are some advantages here, including the fact that tests can be run on a live, production db without contaminating it (and thus also move between QA and support as a tool), and we don't require any additional components to run the tests. In fact you can run the tests passably using just psql.

One possible direction we are considering going is to move the test scripts to pgTAP and also centralize test data logic. This would seem to give us more options and might allow us to do exception testing and expand the reach of the test scripts, but it would mean additional dependencies for testing, and would likely rule out as a general support tool or one that could be run as part of installation.

Which approach is best? The current one or pgTap? Or would it be better to to adopt a hybrid approach?

share|improve this question
    
I found this to be a useful, though high level article about data validation. It's more about how to approach the testing than specific tests, but it does contain some specific tests and has a lot of useful information: msdn.microsoft.com/en-us/library/gg261774.aspx –  Sam Woods Oct 8 '12 at 18:19
    
that's an interesting link and we will definitely have to include it in our testing strategy long-term. However, the larger question right now is how best to unit test db components. Do people think being dependent on a third party TAP harness in the db is worth it? –  Chris Travers Oct 9 '12 at 2:11
    
I've never used pgTAP, so I can't speak directly to that, but here's walkthroughs of two sql unit testing frameworks. Visual Studio's built in database unit tests: databasejournal.com/features/mssql/article.php/3921471/… and red-gate's sql unit: troyhunt.com/2012/02/making-unit-tests-in-sql-server-first.html –  Sam Woods Oct 16 '12 at 20:13
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.