You can create a method that runs when you initialize a test that is viewed in the right place and simply uses file processing to delete a specific number, however the method you suggest can cause problems if several users try to run unit tests at the same time (in depending on the setting of the test environment).
The method that I usually use is to create a copy of the database in the initialization of the test, then during testing, to remove the used copy, we usually add a pointer to the database name to ensure uniqueness. The biggest problem with this method is that if you cancel the tests during debugging, the database will never be deleted.
source share