Skip to content

how do I run different setup/teardown functions for each test ? #24

Closed
@z00m1n

Description

@z00m1n

I am trying to use runtests(...) to unit-test my stored procedures. What I basically would like to do is

  1. insert/copy some test-data into the database
  2. run a test
  3. 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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions