Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Favorite unit-testing approach for Postgresql functions?

I'm used to developing Java applications, but for a project I do posgresql functions. I would like to write small unittests for these functions.

I'm currently looking for a standard approach. I found pgTap and pgUnitTest, and an article from 2007: http://www.bigsmoke.us/postgresql-unit-testing/

What are you approaches to unit-testing postgresql functions? How do you mock data / separate testdata? How to isolate unit-tests? And which framework or approach is favored (I use jUnit and testNG for java)?

like image 814
Rob Audenaerde Avatar asked Feb 27 '12 11:02

Rob Audenaerde


1 Answers

Take a look on pgTAP. It's powerful framework for postgresql unit-testing.
I prefer to use xUnit tests style, but pgTAP doesn't limit you and allows to use simple functions to write tests.

like image 143
Vladimir Protasov Avatar answered Oct 17 '22 08:10

Vladimir Protasov