what is the options for unit testing in delphi XE4? i'm trying to use DUnit but it seems didn't have any official version for XE4 and source didn't compile
-
additionally there is DUnit2 project but it does not seem to be complete yet. http://wiki.freepascal.org/FPTest There also was someone''s project to enhance DUnit with additional classers, but don't remember the name – Arioch 'The Jul 09 '13 at 07:45
-
@MarjanVenema below found the name – Arioch 'The Jul 09 '13 at 10:49
3 Answers
Delphi has for a long time, and XE4 is no different, shipped with DUnit. You need to make sure that you select it in the install options.
The version that is shipped with Delphi is already updated to work with the version of Delphi that it ships with. Looking at the DUnit sourceforge project, it seems rather moribund. The last commit to the SVN archive that mentions Delphi versions is for Delphi 2009. So it seems clear to me that you are best sticking with the version that ships with Delphi.

- 601,492
- 42
- 1,072
- 1,490
-
[DUnitLite](https://code.google.com/p/dunitlite/) seems alive and kicking and a very nice alternative indeed. – Marjan Venema Jul 09 '13 at 10:14
-
@MarjanVenema Are you sure? Last commit was 5 years ago. Perhaps it still works with modern Delphi, I don't know. – David Heffernan Jul 09 '13 at 10:36
-
@MarjanVenema it is not alternative - but the very description it is just an add-on. The alternative is https://sourceforge.net/p/dunit2/code/97/log/?path= – Arioch 'The Jul 09 '13 at 10:51
-
Hmm, didn't spot that, colleague just tried porting it to 64 bit and that went fine under XE2. @Arioch'The: do you mean add on to DUnit? In that case it indeed isn't an alternative, should have looked more closely before posting then. – Marjan Venema Jul 09 '13 at 12:40
-
@MarjanVenema 1st thank you for the link, i forgoten it. 2nd just open the link of yours and read the 1st phrase there :-) "DUnitLite is an attempt to improve upon the DUnit unit-testing framework for Delphi. It's currently an **add-on library** for DUnit (though, as the name suggests, it **may someday** grow to be a full lightweight testing library in its own right)." – Arioch 'The Jul 09 '13 at 14:38
-
1@Arioch'The you're welcome, but uh..., yeah..., don't rub it in please :-) – Marjan Venema Jul 09 '13 at 18:12
You may be interested with the unit testing features available within our mORMot Open Source framework. See this StackOverflow answer.
In addition with unit testing with classes, just like DUnit, you have at hand a whole mocking/stubbing framework.
Using interfaces, in a SOLID context, is therefore more integrated within this framework than with DUnit. For instance, interface mocking directly links to a test case, so is able to be integrated within the unit test suit.
It is perfectly working with Delphi XE4, in both 32 bit and 64 bit Windows platforms.

- 1
- 1

- 42,305
- 3
- 71
- 159
There is a new project called DUnitX. It is intended to take advantage of newer features in the language and framework and works with Delphi 2010 and later.
Still very much a work in progress, but it is currently active and you will probably recognise some of the people who are working on it.

- 15,076
- 6
- 55
- 70
-
Interesting - I hadn't heard about that (I'm still using DUnit.) Do you know anything else about it? I found the [first thread mentioning it here](https://forums.embarcadero.com/thread.jspa?threadID=87960), but no blog articles etc that I could find... – David Jul 09 '13 at 11:07
-
I wonder if someone compared Dunit2 and DunitX. However since FPC community chosen Dunit2 to be base of their work, and since i expect FPC commmunity to be more active maintainers than what remained of Delphi community, i'd put more hopes on DUnit2 future. – Arioch 'The Jul 09 '13 at 14:40
-
@David M: That is where I first learned about it as well. I'm currently using DUnit, too. I don't know about any other information on DUnitX, but will try to make some time to try it out. – Bruce McGee Jul 09 '13 at 14:56
-
Arioch 'The: I put my hopes on whichever project best suits my needs. Time will tell. – Bruce McGee Jul 09 '13 at 14:57
-
@BruceMcGee well... frequently competing projects do ave some official comparison, commercial ones do it as part of marketing, non-commercial ones do it for self-identification. Like... like ffmpeg.org and libav.org or like Xfree86 and X.org - they usually have some manifesto "why we did not like the old thing and why we took our toys and went away" - i just thought that DUnitX and DUnit2 projects know of each other and have some opinion why the other one is suboptimal. Of course they may be like LLVM and Portable.Net when none is technically better and the popularity would decide the survival – Arioch 'The Jul 10 '13 at 07:55
-
When we've attended Embarcadero training days for XE or FM they tend to be using DUnitX for their testing. Seems it's maintained by one of their in-house developers with a number of other full-time contributors. Having never used Dunit2, I could not say which is better. – SiBrit Mar 17 '14 at 23:01