Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing in Delphi - how are you doing it? [closed]

I'm wondering how the few Delphi users here are doing unit testing, if any? Is there anything that integrates with the IDE that you've found works well? If not, what tools are you using and do you have or know of example mini-projects that demonstrate how it all works?

Update:

I forgot to mention that I'm using BDS 2006 Pro, though I occasionally drop into Delphi 7, and of course others may be using other versions.

like image 684
Drew Gibson Avatar asked Aug 20 '08 16:08

Drew Gibson


People also ask

What is unit testing how should it be done?

Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. This testing methodology is done during the development process by the software developers and sometimes QA staff.

How do you use DUnit in Delphi?

Developing Delphi DUnit TestsAdd(x, y: Integer): Integer; begin Result := x + y; end; function TCalc. Sub(X, Y: Integer): Integer; begin Result := x - y; end; end. The following example shows the test case skeleton file that you need to modify to test the two functions, Add and Sub, in the preceding code.

Which testing method is used for executing the unit testing?

Unit Testing Techniques: Black Box Testing - Using which the user interface, input and output are tested. White Box Testing - used to test each one of those functions behaviour is tested. Gray Box Testing - Used to execute tests, risks and assessment methods.

Is unit testing end to end?

While both add value to the development process, they are different in many ways. End-to-end testing is a testing process in which the tester tests a software application from the user's perspective. Unit testing is a testing process where the developer verifies that individual units of source code work correctly.


2 Answers

DUnit is a xUnit type of unit testing framework to be used with win32 Delphi. Since Delphi 2005 DUnit is integrated to a certan point into the IDE. Other DUnit integration tools for the Delphi IDE can be found here. DUnit comes with documentation with examples.

like image 107
Lars Truijens Avatar answered Sep 17 '22 18:09

Lars Truijens


There are some add-ons for DUnit, maybe this is worth a new entry on SO. Two which I can put on the list now are

  1. FastMM4 integration: Unit tests will automatically detect memory leaks (and other things), works with DUnit 9.3 and newer
  2. OpenCTF is a 'component test framework' based on DUnit, it creates the tests dynamically for all components in the project's forms, frames and datamodules, and tests them using customized rules (open source)
like image 30
mjn Avatar answered Sep 20 '22 18:09

mjn