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
Currently, I am utilizing runn with YAML to execute API tests, which includes the creation and cleanup of test data. The specific method of description is as follows:
steps:
clean:
db:
query: | DELETE FROM product WHERE product_id = '{{ vars.product_id }}'create:
db:
query: | INSERT INTO product ( product_id, name ) VALUES ( '{{ vars.product_id }}', '{{ vars.name }}' )someTest:
req:
/products
However, using this method, the data in the table inevitably remains after the test execution.
Alternatively, if I move the clean step to the end and a test fails midway and is re-run, a duplicate key error occurs, making management difficult.
To alleviate this, I request the addition of a feature that allows the use of hooks commonly used in unit testing, such as before/after and beforeAll/afterAll.
before:
create:
db:
query: | INSERT INTO product ( product_id, name ) VALUES ( '{{ vars.product_id }}', '{{ vars.name }}' )after:
clean:
db:
query: | DELETE FROM product WHERE product_id = '{{ vars.product_id }}'steps:
someTest:
req:
/products
This will likely enable more effective and efficient preparation and cleanup of test data.
The text was updated successfully, but these errors were encountered:
Currently, I am utilizing runn with YAML to execute API tests, which includes the creation and cleanup of test data. The specific method of description is as follows:
However, using this method, the data in the table inevitably remains after the test execution.
Alternatively, if I move the
clean
step to the end and a test fails midway and is re-run, aduplicate key error
occurs, making management difficult.To alleviate this, I request the addition of a feature that allows the use of hooks commonly used in unit testing, such as
before/after
andbeforeAll/afterAll
.This will likely enable more effective and efficient preparation and cleanup of test data.
The text was updated successfully, but these errors were encountered: