Delphi2005 structures with DUnit and agile development platform

  Before using the Java package of things, anything to get Eclipse.    Now that use Delphi to an IM software reason, think of how can reconstruction and unit testing of a move to the side to Delphi.    Book said to the existing code and unit testing will deepen the understanding of the code, and can be used as the basis for improving the code, which is not exactly what I to do?    So, in order to build such a platform agile, I Delphi2005 DUnit and a small point attempts, and the results recorded in the next to share with you. 

  1, download Delphi2005 
  Borland China because the company does not sell in the professional version, in view of architects and enterprise version of the price, it can only download from the Internet version of a D done for personal use.    Delphi2005 relatively large size, but also need Update1 CD, it is recommended by BT download 2 CD version.    Seed the following address: 
  Http://www.delphifans.com/SoftView/821.html 

  2, the sp1 download Delphi2005 
  It is said that after the patch can be played faster, but the patch could be installed to slow, we must also use CD-ROM.    Download the following address: 
  Http://www.delphifans.com/SoftView/970.html 

  3, download DUnit 
  Https: / / sourceforge.net / projects / dunit / 

  4, the installation Delphi2005 + sp1 
  To the attention of a keygen and installation of the register must be installed at the same time. Net and win32 version of the delphi, C # builder is indifferent.    If only installed win32 version will lead to reconstruction features are not available (this is a bug delphi2005 performance is to use the time and Reconstruction. Net abnormal window). 

  5, streamlining Delphi2005 
  On the step because at the time when installed. Net version, leading to the start time delphi become very slow.    This can be through the revision of the registry, delete some of the IDE package to achieve.    Specific practices in Delphi is a fast way to the goal behind parameters - rxxx, which is BDS.exe-rxxx.    Xxx let you specify this, and then you will in the HKEY_CURRENT_USER \ Software \ Borland \ xxx (this is the name you selected xxx) \ 3.0 \ Known IDE Packages found in those damned packages.    And not pay attention to other network elements as win32 purification too clean cut, as not spent on reconstruction.    I have come to the test many times after a more streamlined as follows 
  "$ (BDS) \ \ Bin \ \ vclmenudesigner90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ win32debugproide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ htmide90.bpl" = "HTML Designer Package" 
  "$ (BDS) \ \ Bin \ \ iteidew3290.bpl" = "Borland Integrated Translation Environment for Win32" 
  "$ (BDS) \ \ Bin \ \ SrcManIDE90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ todoide90.bpl" = "Borland ToDo" 
  "$ (BDS) \ \ Bin \ \ htmlhelp290.bpl" = "Borland HtmlHelp Viewer" 
  "$ (BDS) \ \ Bin \ \ idefilefilters90.bpl" = "IDE File filters" 
  "$ (BDS) \ \ Bin \ \ startpageide90.bpl" = "Borland Start Page IDE Package" 
  "$ (BDS) \ \ Bin \ \ refactoride90.bpl" = "Borland Core Refactoring Package" 
  "$ (BDS) \ \ Bin \ \ dbkdebugide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ exceptiondiag90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ bin \ \ deployide90.bpl" = "Deployment Manager" 
  "$ (BDS) \ \ Bin \ \ plugview90.bpl" = "Pluggable Tree View Package" 
  "$ (BDS) \ \ Bin \ \ coreproide90.bpl" = "Core IDE Pro Package" 
  "$ (BDS) \ \ Bin \ \ IDETools90.bpl" = "Build Tools" 
  "$ (BDS) \ \ Bin \ \ unittestide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ historyide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ htmltidy90.bpl" = "HTML Tidy Formatter" 
  "$ (BDS) \ \ Bin \ \ HTMLFmt90.bpl" = "HTML Internal Formatter" 
  "$ (BDS) \ \ Bin \ \ mlcc90.bpl" = "Markup Language Code Completion Package" 
  "$ (BDS) \ \ Bin \ \ delphivclide90.bpl" = "Delphi VCL Designer IDE Package" 
  "$ (BDS) \ \ Bin \ \ delphicoreproide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ win32debugide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ htmlide90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ delphide90.bpl" = "Delphi Win32 IDE Personality" 
  "$ (BDS) \ \ Bin \ \ mtspro90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ mtsent90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ iteidenet90.bpl" = "Borland Integrated Translation Environment for. NET" 
  "$ (BDS) \ \ Bin \ \ NetImportWiz90.bpl" = "(Untitled)" 
  "$ (BDS) \ \ Bin \ \ DataExplorer90.bpl" = "(Untitled)" 
  Although there are a few slow start, but managed to endure. 

  6, compile and install DUnit 
  You know with the way the compiler into dcu DUnit placed in the directory you specify.    And to add to the catalogue of Delphi Tools-> Environment Options-> Delphi Options-> Library-win32 in the Library Path. 
  In addition to the compiler out DUnit.exe 

  7, I recommend the establishment of projects is the way to write when the Delphi program interface and the background separately, is open two specific projects, an ordinary VCL, a DLL project.    No, no, I mean, do not let you use this method to share DLL code.    This DLL item contains all the background documents, as well as background on the test.    DUnit the DLL to use DUnit which can be read out from the test and run it.    In fact GUI part of the project that includes all of the documents, that is to say, two of the more points than in the original on the basis of a single project with a special test for the DLL works. 
  Project is divided into three: GUI, Core, TestCore.    Works include a GUI + Core, including two works Core + TestCore.    The output of a project is Win32Exe procedures.    The project output is Win32Dll procedures. 
  These two projects could then be put in a Project Group. 

  8, and the preparation of a general test of written procedures Dephi no different, we must remember that the function of the GUI-out background, the background Testable.    Tests were written on the two projects, I put the names of the two projects is called Core.    Below on the Core of adding a basic testing, inspection 1 +1 is not equal to 2. 
  The establishment of TestCase 

  Unit TestBasic; 

  Interface 

  Uses 
TestFramework;

  Type 
  TBasic = class 
  Public 
  Function Add (a, b: integer): integer; 
  End; 

  TTestBasic = class (TTestCase) 
  Private 
  FBasic: TBasic; 
  Public 
  Procedure SetUp; override; 
  Procedure TearDown; override; 
  Published 
  Procedure TestAdd; 
  End; 

  Implementation 

  Function TBasic.Add (a, b: integer): integer; 
  Begin 
  Result: = a + b; 
  End; 

  Procedure TTestBasic.SetUp; 
  Begin 
  FBasic: = TBasic.Create; 
  End; 

  Procedure TTestBasic.TearDown; 
  Begin 
FBasic.Free;
  End; 

  Procedure TTestBasic.TestAdd; 
  Begin 
  CheckEquals (2, FBasic.Add (1, 1)); 
  End; 

  Initialization 
  RegisterTest (''TTestBasic.Suite); 

  End. 

  Laws Core.bdsproj (KAO, what odd suffix ah) 
  To begin end. Changed 
  Exports 
  RegisteredTests name 'Test'; 
  End. 
  Uses and add some TestFramework. 

  DUnit is through this export function in the dll we find the registration of TestCase. 

  9, running DUnit 
  DUnit added to the Tools menu bar, as many convenience.    Parameters not only filled out.    I did not use inside the macro directly fill the absolute path.    If you and I, like so directly fill the absolute path, from the Tools menu under direct election DUnit can see a list of tests, point operation will see a flashing green light has. 
  If you are not the DUnit added to the Tools menu, then to the File-> Load Test selection window of documents found in Core Project compiled by the dll, core.dll. 

  —- 

  Reconstruction of functions and thus have the unit testing.    The remaining code is added to the existing tests, and then reconstructed things. 

Bookmark it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Google
  • DotNetKicks
  • DZone
  • Furl
  • Netvouz

Tags:

Releated Articles


0 Comments to “Delphi2005 structures with DUnit and agile development platform”

No Comments. Send your comment.

Leave a Reply

You must be logged in to post a comment.