我们可以使用DUnit写什么样的测试用例?

Vis*_*ari 6 delphi dunit delphi-7 parameterized-unit-test minimum-coded-unit

我使用的是Delphi 7.

我是DUnit的新手,我的疑问是我可以使用DUnit编写什么样的测试用例以及如何(这对我来说非常重要).

是否可以为特定的按钮点击事件编写测试用例?因为在那种情况下可能会使用大量代码,其中使用各自的数据库相关过程或函数调用更多单元.在这种情况下,编写测试用例的最佳方法是什么?(如果可能的话,一个例子或推荐对我来说将是一个很大的帮助).

因为,在示例DUnit项目中,我们无法编写整套应用程序代码,因为在某些情况下可能需要创建一些其他形式.

所以,我怀疑这种情况如何编写测试用例,一般来说我们可以使用DUnit编写哪种类型的测试用例,重要的是如何编写?

Jan*_*gen 17

这应该是一个评论,但我写它作为答案,因为它不适合评论.

我建议你做两件事:

  • 调查将业务逻辑与接口分离(重构代码)
    通常,将代码拆分为自包含单元,然后"自下而上"单元测试单元的核心功能.您没有对GUI进行单元测试.谷歌例如"单元测试解耦德尔福单位"

  • 查看以下链接,了解有关单元测试的示例:

http://www.howtodothings.com/computers/a928-automated-testing-with-dunit.html
http://www.nldelphi.com/cgi-bin/articles.exe/ShowArticle?ID=14697
https:// lists.sourceforge.net/lists/listinfo/dunit-interest
http://www.delphi-treff.de/tutorials
http://sourceitsoftware.blogspot.com/2008/10/getting-line-numbers-in-dunit- test.html
http://wiert.me/2010/09/08/delphi-use-tstrings-to-parse-non-standard-separated-strings-and-validate-it-with-dunit-tests/
http:/ /delphi.about.com/od/vclusing/a/autotestvcl.htm
http://dunit.sourceforge.net/
http://delphi.about.com/od/toppicks/tp/aatpdebug.htm
http:// www .nickhodges.com /后/德尔福嘲弄最Basics.aspx
http://www.finalbuilder.com/Resources/Blogs/tabid/458/EntryId/287/Introducing-Delphi-Mocks.aspx
https://github.com/Vsofttechnologies/delphi-mocks
http://www.uweraabe. de/Blog/2012/03/17/a-dunit-folder-iterator-extension/
Delphi中的单元测试 - 你是怎么做到的?
http://members.optusnet.com.au/~mcnabp/
http://www.nickhodges.com/post/The-Vocabulary-of-Unit-Testing.aspx
http://hanselminutes.com/169/the-本领域单元测试与-罗伊-osherove的-