I am using Delphi 7.
I am new to DUnit, my doubt is what kind of test cases I can write using DUnit and how (that is very important for me).
Is it possible to write test cases for a particular button click event? Because in that event there may be a big set of code used in which more units are called with their respective database related procedures or functions. In that case, what is the best approach to write the test cases and how? (If possible, an example or referal would be a great help for me).
Because, in sample DUnit project we can't write entire sets of application code, because there may be some other form required to be created in some cases.
So, my doubt is for such situations how to write test cases, and generally also what type of test cases we can write using DUnit and importantly how?
This should be a comment, but I'm writing it as an answer because it won't fit in a comment.
I suggest you do two things:
Investigate decoupling your business logic from your interface (refactoring your code)
Generally you split your code into self-containing units, then unit test the core functionality of a unit "from the bottom up". You don't unit test the GUI.
Google e.g. "unit testing decoupling delphi units"
Check out the below links for examples for what you can do with unit testing:
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/post/Delphi-Mocks-The-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/
Unit testing in Delphi - how are you doing it?
http://members.optusnet.com.au/~mcnabp/
http://www.nickhodges.com/post/The-Vocabulary-of-Unit-Testing.aspx
http://hanselminutes.com/169/the-art-of-unit-testing-with-roy-osherove