I am using AJAX to unit test my insert, update, and delete operations on a database. If it matters, I am using the QUnit test framework for this.
To unit test each of these, it is necessary to insert the entry first and delete it again once a test is over. My unit tests work perfectly operating on this logic; however, some occasionally fail if the test is interrupted by a page refresh because the test stops halfway and thus the entry is not deleted properly for the next entry, thus causing the next test's insert to be treated like a duplicate entry (as like a double submission).
How would you unit test these operations such that all the tests will still pass even if the page refreshes and interrupts the tests? Currently I am using transactions, but they only work as long the page is not refreshed.
Aucun commentaire:
Enregistrer un commentaire