tfs - How to unit test the database code for Sql Server 2014 -
i working on developing unit test framework db code in sql server 2014. requirement following:
- the tool should provide enough assertions check db schema, positive values, negative values, exceptions , constraints.
- the tool should provide mocking , stubbing db stored procs
- the tool should able generate .trx reports passed/failed test cases want pulbish these reports using vsts/tfs build
- code coverage if possible
- the tool should able integrate tfs build template ci purpose.
after doing research, think have 3 options of tools ssdt mstest , tsqlt as:
- using ssdt test database initialization/cleanup , using mstest sql unit testing has no mocking feature , options assertion limited. cleanup manual
- using tsqlt unit test cases. nice , powerful tool not provide gui ssdt. redgate gui paid not possible in case. seems tougher integrate tfs builds. , not produce reports in .trx format in .xml format.
- using combination of ssdt , tsqlt ssdt db initialization, tfs integration , runnig tsqlt code mstest project , tsqlt db unit testing.
can suggest better approach on db unit testing?
thanks
steph locke pretty has wrapped you:
https://itsalocke.com/unit-testing-in-ssdt-a-quick-intro/
highlights:
- use tsqlt mocking (it awesome)
- grab test runner runnint tsqlt tests (no trx format start) https://the.agilesql.club/projects/tsqlt-test-runner/about - lets run tests within visual studio / test explorer window
- for code coverage use sqlcover (https://the.agilesql.club/blogs/ed-elliott/2016-04-08/sqlcover-code-coverage-for-sql-server-t-sql)
ok?
ed
Comments
Post a Comment