samedi 23 avril 2016

Should I add a "real-delete" method on DAO for integration test?

I am writing some integration tests for some legacy code. To ensure the functions behave as expected, I need to setup the fake data, invoke the testing APIs, then clean up the data.

Due to policy reason, we can only access the database via tools like Hibernate and MyBatis, never direct connection. However, our delete() method on the DAOs is always of the soft-deletion style (ie, turn on the is_delete flag.) So the clean-up actually just turns on the is_delete flag, and the fake data is still there!

So, should I add a "real-delete" method on the DAOs for the integration tests, or there's a better way to deal with this problem?

Aucun commentaire:

Enregistrer un commentaire