I have built an Integration Test as a Visual Studio 2017 test project. This project will be run as a VSTS Build step.
Specifically, I am testing a database (PostgreSQL) provisioning app's correct function.
This means that this unit test will be using the Provisioning API to create a database and a database user in the database server, and the test will also be validating the correct structure of the database's schema, tables, and columns.
This results in the database server containing several databases constructed only from the integration test running.
It is planned that any failed databases will remain in the server so that they can be dissected for all errors, but we have no need to keep the successfully tested DB's.
My current problem is that since the test is in a Unit Test Project, the test methods run their asserts, and it's done.
How can I trigger a script to drop the database from the Postgres server when my Integration Test passes as 100%?
I only have ideas on what to do. Do I run an additional VSTS build step after the test step to run the script? Or do I have my test methods return a bool, and gather up the bools at the end of the project in a method that would run the script?