选择显示字体大小

用delphi2005和dunit搭建敏捷开发平台

1、下载delphi2005
因为borland公司在中国不出售专业版本,鉴于架构师和企业版的天价,所以只能从网络上下载一个d版的做个人使用。delphi2005体积比较大,而且update1也需要cd,所以推荐用bt下载2cd版本。种子的地址如下:
http://www.delphifans.com/softview/821.html

2、下载delphi2005的sp1
据说打过这个补丁之后能快一些,但是这个补丁安装起来可慢了,还需要用光盘。下载地址如下:
http://www.delphifans.com/softview/970.html

3、下载dunit
https://sourceforge.net/projects/dunit/

4、安装delphi2005+sp1
注意一下keygen中有一个register以及安装的时候一定要同时安装.net和win32版本的delphic#builder则无所谓。因为如果只安装win32版本会导致重构功能不可用(这是delphi2005的一个bug,表现就是用重构的时候出现.net的异常窗口)。

5、精简delphi2005
因为上一步的时候同时安装了.net版本,导致delphi启动的时候变得非常慢。这个可以通过修改注册表,删掉一些ide的包来实现。具体的做法是在delphi的快捷方式目标后面加上参数-rxxx,也就是bds.exe -rxxx。这个xxx任由你指定,然后你就会在hkey_current_user\software\borland\xxx(这个就是你选定的名字xxx)\3.0\known ide packages中发现那些该死的包。注意不能和网络上别的win32纯化分子那样删得太干净了,那样重构就没法用了。我自己试验多次之后得出的一个比较精简的列表如下
"$(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\\iteid.net90.bpl"="borland integrated translation environment for .net"
"$(bds)\\bin\.netimportwiz90.bpl"="(untitled)"
"$(bds)\\bin\\dataexplorer90.bpl"="(untitled)"
虽然启动还是有些慢,不过总算能忍受了。

6、编译并安装dunit
用你知道的办法把dunit编译成dcu,放入你指定的目录。并把该目录添加到delphi的tools->environment options->delphi options->library-win32的library path中。
另外把dunit.exe给编译出来

7、建立工程
我推荐的方式是写delphi程序的时候把界面和后台分开,具体就是开两个项目,一个普通的vcl项目,一个dll项目。不,不,我的意思并不是让你用dll这种方式来共享代码。这个dll项目包含文件是所有后台的内容,以及对后台的测试。产生的dll给dunit用,dunit能够从其中读出测试并运行。而实际上gui部分的那个工程是包含了所有的文件的,也就是说分与其说分两个工程,不如说是在原来的单个工程的基础上加上了一个专门用于测试的dll工程。
项目分为三块:gui,core,testcore。工程一包括gui+core,工程二包括core+testcore。工程一的输出是win32exe程序。工程二输出是win32dll程序。
然后可以把这两个工程放到一个project group中。

8、编写测试
工程一和普通写dephi程序没有什么两样,要记得把gui的功能分出来后台,让后台testable。测试都是写在工程二中的,我把工程二的名字就叫做core。下面就在core中添加一个最基本的测试,检查1+1是不是等于2。
建立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.

修改core.bdsproj(kao,什么古怪的后缀啊)
把begin end.改成
exports
  registeredtests name 'test';
end.
并在uses部分添加testframework。

dunit就是通过这个export的函数在dll中找出我们注册的testcase的。

9、运行dunit
把dunit添加到tools菜单下吧,那样方便许多。只是参数不好填写。我没有用里面的macro,直接填了绝对路径。如果你和我一样这样直接填的绝对路径,那么从tools菜单下选dunit就能直接看到一个测试列表了,点运行就会看到一个绿灯亮起了。
如果你不是把dunit添加到tools菜单,那么就要从file->load test的文件选择窗口中找到core项目编译出来的dll,core.dll。


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons