是否可以用SQL实现测试驱动开发?

发布于 2024-10-07 13:38:45 字数 89 浏览 0 评论 0原文

我不是 Db 人。我只是好奇是否有可能在 Sql 中编写断言,以便您可以为脚本、存储过程等编写单元测试,然后甚至对会话实施测试驱动开发方法?

谢谢!

I am not a Db guy. I am just curious if there is a possibility to write asserts in Sql so that you can write unit tests for your scripts, for your sprocs etc. and then even implement a Test Driven Development approach to your sessions?

thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哭了丶谁疼 2024-10-14 13:38:46

实际上,您可以做到这一点,不是直接通过 SQL,而是通过您编写应用程序的语言。

当然,SQL 必须封装在 DAL(数据访问层)和存储库(或其他数据访问类)获取的所有数据中。您可以对这些类进行单元测试,最后运行 SQL 脚本。所以,基本上您将测试您的 SQL 代码。

对我来说,这比尝试用 SQL 编写此类测试更简单。 :)

不久前我曾想过:
http://www.beletsky.net/2010/11 /testing-database-and-test-database.html

You can do that actually, not directly from SQL throught, but the language you do your application.

Of cause you SQL must be incapsulated in DAL (Data Access Layer) and all data got by Repositories (or other data access classes). You can do unit testing of those classes, that would be running SQL scripts at the end. So, basically you will test your SQL code.

It is simplier to me, than trying to write such tests in SQL. :)

Sometime ago I had thought on that:
http://www.beletsky.net/2010/11/testing-database-and-test-database.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文