创建模拟存储过程存储过程

由网友(可爱鬼)分享简介:有没有一种简单的方法来自动/生成基于SQL存储的特效嘲笑或存根? Is there a simple way to automate/generate mocks or stubs based on sql stored procs? 我想掩盖的情况,即有人添加必需的输入参数,然后,我会希望尚未更新所需的参数测试...

有没有一种简单的方法来自动/生成基于SQL存储的特效嘲笑或存根?

Is there a simple way to automate/generate mocks or stubs based on sql stored procs?

我想掩盖的情况,即有人添加必需的输入参数,然后,我会希望尚未更新所需的参数测试失败。

The situation I am trying to cover is when changes are made to a proc in development, i.e. someone adds a required input parameter, I would then want the test that has not been updated with the required parameter to fail.

推荐答案

虽然不太自动化的另一种方法是创建一个包含了一组用于存储过程你有兴趣在执行语句的脚本,通过运行这些,你可以捕捉到那些当存在变更的参数失败。您也可以编写脚本在MS SQL的EXEC存储过程位

Though less automated another approach would be to create a script that contains a set of execution statements for the stored procedures you are interested in. By running these you could captured the ones that fail when there is a changed parameter. You also could script out the exec store procedure bit in MS SQL

例如

exec [DATABASE].dbo.[StoredProc] parameter1, parameter 2

验证结果这不会提供任何机制。对于多个COM prehensive方法,你可以看看下面这个例子放在一起的简单通话的通讯,使用C#和NUnit建立一个测试工具。

This would not provide any mechanism for verifying results. For a more comprehensive approach you might look at this example put together in the Simple-Talk newsletter that builds a test harness using c# and NUnit.

关闭这些漏洞 - 测试存储过程

阅读全文

相关推荐

最新文章