创建模拟存储过程

创建模拟存储过程

本文介绍了创建模拟存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法来自动/生成基于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.

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

这篇关于创建模拟存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 08:32