How to do database unit testing?

前端 未结 7 1115
时光取名叫无心
时光取名叫无心 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:37

    A list of items that should be reviewed and considered when staring with database unit testing

    • Each tester needs a separate database, in order to avoid interfering with activities of other tester/developer
    • To have an easy way of creating a database to be tested (this is related to having a SQL Server database under version control). This is specifically useful when trying to find what went wrong if some tests fail
    • Focus on specific areas and creating tests for a single module instead of covering all at once. Adding tests granularly is a good way to be efficient
    • Make sure to provide as many details as possible when a test fails, to allow easier debugging
    • Use one and the same test data for all tests

    If test are implemented using tSQLt framework, the unit testing process could be complicated when dealing with a lot of databases from multiple SQL Server instances. In order to maintain, execute and manage unit tests directly from SQL Server Management Studio, ApexSQL Unit Test can be used as a solution

提交回复
热议问题