Delphi ???????????DUnit
???????????? ???????[ 2013/9/24 10:39:05 ] ????????
???????дJ(rèn)ava???????????????????JUnit?????????????Delphi???????????Delphi??????????????DUnit??
????DUnit??XUnit?????е???????Extreme Programming???????Xtreme Testing?????????
????DUnit???÷???JUnit??????????????????????????????????DUnit?????????http://dunit.sourceforge.net/??????????http://sourceforge.net/projects/dunit/
??????DUnit????????????????????D:/Study/DelphiLib/??????Delphi 7????DUnit·?????? Tools- > Environment Options ????? Library -> Library Path??????DUnit?????????
????????????CnPack ??Delphi??????????????????? File -> New -> Other -> CnPack -> DUnit????????????? ?н????μ??????????
?????????????????????????????????AppFun?е? GetString() ?? Add() ??????
TAppFun.pas
(*
UTest by Jason
2010-01-06 21:30
*)
unit AppFun;
interface
uses SysUtils;
type TAppFun = class(TObject)
public
class function GetString(sName: string; iAge: Integer): string;
class function Add(iA: Integer; iB: Integer): Integer;
end;
implementation
class function TAppFun.GetString(sName: string; iAge: Integer): string;
begin
result := 'Hello ' + sName + '?? your age is ' +
IntToStr(iAge);
end;
class function TAppFun.Add(iA: Integer; iB: Integer): Integer;
begin
Result := iA + iB;
end;
end.
UTest.pas
(*
UTest by Jason
2010-01-06 21:30
*)
unit UTest;
interface
uses
Windows?? SysUtils?? Classes?? TestFramework?? TestExtensions;
type
TTest = class(TTestCase)
protected
procedure SetUp; override;
procedure TearDown; override;
published
procedure Test;
procedure TestGetString();
end;
implementation
uses
AppFun?? Dialogs;
procedure TTest.Setup;
begin
ShowMessage('In Setup!');
end;
procedure TTest.TearDown;
begin
ShowMessage('In TearDown!');
end;
procedure TTest.Test;
begin
Self.Check(TAppFun.GetString('Jason'?? 22) = 'Hello Jason?? your age is 22'??
'Second Test');
end;
procedure TTest.TestGetString();
begin
Check(TAppFun.Add(3?? 5) = 8?? 'First Test');
end;
initialization
TestFramework.RegisterTest(TTest.Suite);
end.
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11