Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing stored procedures

How to test procedures with record type parameters.I have a procedure which takes test_ap ,basic and user_name as inputs.where test_ap is of record/row type,basic record array type and user_name charater varying.

I need to test the procedure in pgadmin.

test_client(test_ap test_base, basic test_base_detail[], user_name character varying)

Any suggestions plz.

like image 496
giri Avatar asked Aug 29 '26 06:08

giri


2 Answers

If you want to do full comprehensive testing of your stored procedures etc, pgTAP comes highly recommended.

Otherwise, for a homebrew result, you might want to create a schema full of test data and expected output, and then run a select query on the test data and compare the output ( using SQL of course ) to the expected output.

But really, if you're wanting more than just a one-off "ok, it works" test, you probably should go with the pgTAP solution. Fully fledged database consistency checks ==> win.

like image 149
Kent Fredric Avatar answered Aug 30 '26 20:08

Kent Fredric


Not sure why you have to test it from pgadmin. Doesn't let you scale out to automated testing. Can you use psql or pick your language tool(Java, Ruby, Perl, Python..) to create a test bed that would allow you to do this testing?

like image 29
Kuberchaun Avatar answered Aug 30 '26 21:08

Kuberchaun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!