dunit

DUnit Testing in a Midas/DataSnap project

How does one setup DUnit Testing in a Midas/DataSnap project in Delphi 2006 Edit How does one set up a Dunit Test into a TRemoteDataModule The project wizard in Delphi 2006 does not work with TRemoteDataModule ...

How to make Delphi DUnit test fail when TSQLConnection.Connected = true

When using Delphi IDE, it will silently change SQLConnection.Connected to "true" when populating field or table lists in various properties. Since I don't want to release with Connected = true, I need my dunit test to fail when TSQLConnection.Connected is left true in dfm. ...

Unit-testing Delphi data modules

If all the business logic is present in a datamodule (TSQLDataSets and TDataSetProviders) how would you refactor the code to make the application more appropiate for unit testing? ...

Comparing issues in DUnit CheckEquals with Currency Field Values

I'm comparing some currency values in DUnit but it is not working at all on my machine (work on others, but not on mine). An example: CheckEquals(16.65, SomeCurrencyFieldValue); Raises: expected: <16,65> but was: <16,65> if do the following the comparison then works: var Temp: Currency; begin Temp := 16.65; CheckEquals(Temp...

Measuring code coverage in Delphi

Is there any way to measure code coverage with DUnit? Or are there any free tools accomplishing that? What do you use for that? What code coverage do you usually go for? Jim McKeeth: Thanks for the detailed answer. I am talking about unit testing in the sense of a TDD approach, not only about unit tests after a failure occured. I'm inte...

How can I enable the memory leak tracking with FastMM in DUnit?

In the GUI test runner, the menu items for memory leak checking are inactive (grayed out). Is there a special switch I have not found yet to activate them? Using DUnit 9.4 (from Delphi 2009 or from the sourceforge Subversion repository) and FastMM4.92 ...

Data-driven DUnit testing

The way DUnit normally works is you write some published methods, and DUnit runs them as tests. What I want to do is a little different. I want to create tests at run time based on data. I'm trying to test a particular module that processes input files to creates output files. I have a set of test input files with corresponding known goo...

How to start unit-test old and new code ?

I admit that I have almost none experience of unittesting. I did a try with DUnit a while ago but gave up because there was so many dependencies between classes in my application. It is a rather big (about 1.5 million source lines) Delphi application and we are a team that maintain it. The testing for now is done by one person that use ...

How can I test a Singleton class with DUnit?

Or it's better to use another Design Pattern? ...

Getting DUnit Test Coverage stats using FinalBuilder and AQTime

We have a large Delphi project (1.5 million lines of code), and we're moving to using agile processes. We already have a continous integration environment (FinalBuilder) which I've updated to include unit tests (dUnit) and code metrics (CodeHealer) in the e-mails to everyone in our development team. Our unit test coverage isn't great...

DUnit: How to run tests?

How do i run TestCase's from the IDE? i created a new project, with a single, simple, form: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) private public end; var Form1: TForm1; implementation {$R *.DFM} end. Now i'll add a...

Why does 'uses unit' disappear when I had a new unit ?

I have a Unit test project for my Application using DUnit framework. This project have a unit surrounded by a $IFDEF to output test-results in a xml file instead of the gui or just command line. XML_OUTPUT define is enabled by switching the Build configuration. program DelphiCodeToDoc_Tests; uses TestFramework, TextTestRunner, Sy...

How do I prevent my unit tests from requiring knowledge about implementation internals when using mock objects?

I'm still in the learning stages regarding unit-testing and in particular regarding mocking (I'm using the PascalMock and DUnit frameworks). One thing I now stumbled over was that I couldn't find a way around hard-coding implementation details of the tested class/interface into my unit test and that just feels wrong... For example: I wa...