Dunit初步詳解(2)

發表于:2011-12-22來源:未知作者:娃娃點擊數: 標簽:dunit
end; implementation procedure TTestCaseFirst.TestFirst; begin Check(BeTestForm.BeTestFunction(1,3)=3,First Test fail); end; procedure TTestCaseFirst.TestSecond; begin Check(BeTestForm.BeTestFunction(1

  end;

  implementation

  procedure TTestCaseFirst.TestFirst;

  begin

  Check(BeTestForm.BeTestFunction(1,3)=3,'First Test fail');

  end;

  procedure TTestCaseFirst.TestSecond;

  begin

  Check(BeTestForm.BeTestFunction(1,3)=6,'Second Test fail');

  end;

  initialization

  TestFramework.RegisterTest(TTestCaseFirst.Suite);

  end.

  5.修改Project主文件,點擊Project->View Source,查看項目的源碼。並以下面的程序碼取代:

  program TestCaseProject;

  uses

  Forms,

  TestFrameWork,

  GUITestRunner,

  TestUnit in 'TestUnit.pas';

  {$R *.res}

  begin

  Application.Initialize;

  //Application.Run;

  GUITestRunner.RUnRegisteredTests;

  end.

  6.一切搞定,注意一點(很重要):被測單元和測試用例一定要保存在同一個目錄下!

  下面開始運行我們的TestCase.,點擊運行按鈕。

  我們這里有一個TestSecond是錯誤的,所以執行中會有Failures出現!

  下面附上兩個案例的源碼文件!

  附件: 案例.rar (2006-6-15 16:30, 653.91 K)

  Dunit的路徑加載到Delphi中

  TestCase1 運行結果

  TestCase2 運行結果

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97