I'm just getting into writing #tests. It hasn't really been part of any shop I've worked for. It should've, and I feel the worse for it. Because things have randomly started to fall apart in my code, I'm starting.
I have tests for my DB interface code, which I can test by sending "SELECT 2 + 2" and see if 4 is the output. That's fine. But the code that connects to that are CRUD libraries, and while I'm fine with the Read part, asking for the list of tables and seeing if I get a list, etc., it strikes me that Create, Update and Delete are more difficult to test, especially if you don't have an explicit "test" database to point the library at.
This has been a stumbling block for me for a while. Any pointers on that?
I have tests for my DB interface code, which I can test by sending "SELECT 2 + 2" and see if 4 is the output. That's fine. But the code that connects to that are CRUD libraries, and while I'm fine with the Read part, asking for the list of tables and seeing if I get a list, etc., it strikes me that Create, Update and Delete are more difficult to test, especially if you don't have an explicit "test" database to point the library at.
This has been a stumbling block for me for a while. Any pointers on that?
No comments:
Post a Comment