I want to drop my database before I run my test script at every time. I just want to know if I can run the bash script to drop my database using pre-request tab & how to write that kind of script?
Postman uses JavaScript under the hood, so this will be a no.
However, what database are you using?
Does the database have an API that you can call using sendRequest().
On a side note, using the pre-request script to ensure that the system under test is in a known state before running your test is better than relying on an tear down script in the tests tab that may or may not run successfully. So 2 thumbs up on what you are attempting to do.
Thanks Mike Jones your reply.
I used postgress database as my database
Postgres has its own protocol\driver for communication with the database.
However, it looks like there are several third party options that you might want to consider that allow HTTP API access.
This is official one (but its from 2015, so buyer beware).
PostgreSQL: PostgreSQL RESTful API
This is another one, which looks a bit more detailed.
PostgREST Documentation — PostgREST 11.1.0 documentation
If you do consider installing one of these, I would pay special attention to the maintenance of these code stacks. The last link does look like its currently being maintained.
Thanks Mike Jones for your valuable reply. I will take a look for these link
Regards,
Yashodha Lakmini
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.