ReadMe.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. UnitTests for Indy
  2. ---------------------------------
  3. Priorities:
  4. 1) Keep It Simple
  5. 2) Do not couple to any specific unit test framework.
  6. - use appropriate IdTest.pas units to plug into required framework.
  7. Units are named IdTest*, so they can be easily searched/listed.
  8. eg using UnitExpert (http://www.epocalipse.com/downloads.htm) ctrl-u, "idtest", lists all available test units.
  9. ---------------------------------
  10. Guidelines for writing unit tests:
  11. 1) Assert() should not contain function calls. turning off assertions in compile options should not alter the functionality.
  12. bad:
  13. Assert(ReadLn='');
  14. good:
  15. aStr=ReadLn;
  16. ASsert(aStr='');
  17. 2) test procedures should be have 'published' visibility (so win32 RTTI can be used to enumerate them) and be named starting with 'Test'.
  18. public
  19. //bad, won't be called
  20. procedure WriteTest;
  21. published
  22. //good
  23. procedure TestRead;
  24. 3) additional debug code should not be left in for 'release'.
  25. (by default) data should not be written to the test pc, eg log files.
  26. 4) don't raise exceptions in except-blocks, causes memory leak in delphi
  27. ---------------------------------
  28. ToDo:
  29. add another layer to the component heirachy that defines the interface, eg virtual methods etc.
  30. add Setup/TearDown virtuals.
  31. add a mechanism for recording additional debug output.
  32. add a mechanism for supplying tests with configuration settings, eg address/user/password for a live email server to test against. suggest just a name=value stringlist and a DoConfig(TStringList);virtual method.