8kb*_*8kb 5 sql-server testing stored-procedures
当我为存储过程编写单元测试时,它们通常如下所示:
/* Unit test for stored procedure which runs a query */
/* Define #temp table with structure of query results */
/* Define and set variables for stored procedure parameters */
/* If stored procedure queries from a particular table...*/
/* Truncate table and populate with sample data */
/* Call stored procedure using variables but insert results into table */
/* INSERT #temp EXEC usp_TestProc @P1=1, @P2 = 'X' */
/* Query #temp table to confirm that all fields have certain values */
/* Query #temp table to confirm that certain number of rows exist */
/* If results are incorrect, display error message */
Run Code Online (Sandbox Code Playgroud)
虽然这会奏效,但不知何故感觉很笨重,并且在需求不断变化的长期项目过程中很难维护。
归档时间: |
|
查看次数: |
724 次 |
最近记录: |