-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reseed not properly deleting data from database after a test #36
Comments
It's not so strange that data is not deleted. |
I've added a simple fix to also delete data on cleanup. |
@BenjaminDagg Hello. I somehow haven't received any notifications from Github, sorry for that. Will take a look this week. Initially this behavior is by design: no matter what data we have in db, each test will get what it needs as db is restored to initial state before test logic is executed. And this is totally sufficient for my personal use cases. I agree though that it's sort of counter-intuitive to keep any data in db after tests are done. Could you please describe why it's important for you to delete this data, so that I have better context? |
Apparently i was in the same misperception as @BenjaminDagg.
What your're saying makes sense to me but i'm wondering why cleanup doesn't cleanup. When testing a certain service, all tests for that service need the same base data to be present in the database. |
@Remco4EF Thank you for the response, appreciate that.
Likely a bad naming issue, where "cleanup" term is present in both stage name as By design I'm going to check and maybe reconsider this decision by adding data deletion to
Could you please provide some minimal example for that? I'm not sure I'm 100% following. Since idea of this library is to actually guarantee that each test has same data and acts in isolation. This is achieved by describing the desired data state (in xml or inlined) to which db is restored by execution of deletion scripts followed by insertion. |
@uladz-zubrycki I Agree.. naming is key and that threw me in the wrong direction. regarding your question: I've solved this with a second reseeder instance / action scripts which fill table D. all in all... I understand this is an edge case for using Reseed. |
@Remco4EF Could you still please provide a minimal example to look into and reproduce your issue? A few runnable listings of Reseed configuration and data setup or a whole solution as an archive. Thanks again. |
With reseed and xunit the data inserted in the prepare database phase and data inserted during tests are not being deleted from the database when cleanup database is called at the end of the test. The record created during prepare database is not removed from the database after cleanup is called. If I call restore database in the dispose method the records are properly deleted after tests.
SeedActions
Base test class. Constructor gets called before each test where I call Restore Database.
Test Fixture where I can Cleanup Database in dispose which is called after all tests have run.
The text was updated successfully, but these errors were encountered: