You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use runtests(...) to unit-test my stored procedures. What I basically would like to do is
insert/copy some test-data into the database
run a test
remove the test-data
and repeat these three steps for each test function.
I thought I could achieve this by creating a setup function for step 1 and a teardown function for step 3. However, there does not seem to be a way to define which setup/teardown function I want to run for which test function; according to the docs, all test functions just run all functions whose names start with setup in alphabetical order. I don't need more than one setup/teardown function per test, I just need a different one each time.
Am I generally misunderstanding something here or does pgTAP assume all tests use the same setup/teardown ?
The text was updated successfully, but these errors were encountered:
If you need a different one for each test, I think you don't want setup and teardown. Just call your setup function as the first thing you do in the test function. Also, don't worry about removing the data after the test runs: each test function runs in its own transaction, so any data inserted in the test will be rolled back when the test function returns.
I am trying to use
runtests(...)
to unit-test my stored procedures. What I basically would like to do isand repeat these three steps for each test function.
I thought I could achieve this by creating a setup function for step 1 and a teardown function for step 3. However, there does not seem to be a way to define which setup/teardown function I want to run for which test function; according to the docs, all test functions just run all functions whose names start with
setup
in alphabetical order. I don't need more than one setup/teardown function per test, I just need a different one each time.Am I generally misunderstanding something here or does pgTAP assume all tests use the same setup/teardown ?
The text was updated successfully, but these errors were encountered: