How to do database unit testing?

前端 未结 7 1059
时光取名叫无心
时光取名叫无心 2021-01-30 00:15

I have heard that when developing application which uses a database you should do database unit testing. What are the best practices in database unit testing? What are the prima

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 00:57

    I use junit/nunit/etc and code up database unit tests with java or c#. These can then run on an integration server perhaps using a separate schema to the test database.

    The latest oracle sql developer comes with a built in unit testing framework. I had a look into this but would NOT use it. It uses a GUI to create and run tests and stores all the tests in the database so not so easy to put test cases under version control. There are probably other testing frameworks out there I imagine they might be specific to your database.

    Good practices are similar to regular unit tests:

    • put the tests under source control
    • make tests that run fast - don't test too much at once
    • make your tests reproducible

提交回复
热议问题