Questions tagged [dunit]

xUnit-style unit testing for Borland Delphi programs.

DUnit is an Xtreme testing framework for Borland Delphi programs. It was originally inspired on the JUnit framework written in Java by Kent Beck and Erich Gamma, but has evolved into a tool that uses much more of the potential of Delphi to be much more useful to Delphi developers.

Source code and mailing lists are available at DUnit's Source Forge page.

89 questions
9
votes
1 answer

Unit testing a Firemonkey Application

I'm trying to use DUnit, which came with RAD Studio XE2, to unit testing a Firemonkey app (C++). The problem is, DUnit is a VCL project, and this makes me unable to include the Firemonkey Unit Forms (ex.: UfrmMain.h) on the testing project. Even if…
9
votes
2 answers

Update DUnit on Delphi 2010

Does anyone know how to update dUnit which comes with Delphi 2010 to the latest svn source code?
Rafael Colucci
  • 6,018
  • 4
  • 52
  • 121
9
votes
1 answer

DUnit Compare Two Text Files and show Diff

Is there a way to compare two text files and show the diff if they are not identical in dunit? The easy start is to read them to TStringList, however the code for comparing two text file is much more complicated, and the gui in the DUnitGui is not…
none
  • 4,669
  • 14
  • 62
  • 102
9
votes
3 answers

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…
Oliver Giesen
  • 9,129
  • 6
  • 46
  • 82
8
votes
2 answers

In a Dunit project and exe version info is disabled, how do I get it back?

Why cant I set a version info in a Dunit Test projet? The checkbox is disabled for this projetct, but not for other projects. See the screenshot:
Rafael Colucci
  • 6,018
  • 4
  • 52
  • 121
8
votes
5 answers

Using DUnit from the Delphi IDE and avoid breakpoint on exceptions

I'm using Delphi XE and I've got a project group containing the main application and a DUnit test application. From time to time, I go to the DUnit test application to add some tests and run existing one. Some test code generates exceptions which…
jonjbar
  • 3,896
  • 1
  • 25
  • 46
8
votes
5 answers

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…
dmajkic
  • 3,448
  • 1
  • 18
  • 24
7
votes
4 answers

HTTP server for unit tests in Delphi

I need to test some HTTP components in my Delphi app. I use DUnit and want to add some automation into testing. So my testing code need to start the local HTTP server, configure it (for example, prepare for connection break in 3 seconds, or to…
Andrew
  • 3,696
  • 3
  • 40
  • 71
7
votes
1 answer

What Delphi components ship with unit tests?

Given the popularity of unit testing, and the inclusion of DUnit with Delphi, has this been embraced by any component vendors who have released their source along with a suite of unit tests? I'm looking for examples to share with other developers.
Darian Miller
  • 7,808
  • 3
  • 43
  • 62
7
votes
4 answers

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…
Fabio Gomes
  • 5,914
  • 11
  • 61
  • 77
7
votes
2 answers

dunit test result messages in hudson

i am using Hudson as CI server for Delphi 2010 projects. The XMLTestRunner.pas unit writes DUnit test result to a xml file that is used by the hudson xUnit plugin to report test results. The xUnit plugin shows failures but no…
hansmaad
  • 18,417
  • 9
  • 53
  • 94
7
votes
1 answer

DUnit: 'Global' SetUp and TearDown

In DUnit, SetUp and TearDown are called before (and after, respectively) each test method is executed. In SetUp, I create an object that loads data from a file. This is slow, especially if I have many tests. Is there any way to call SetUp once,…
Gabriel
  • 20,797
  • 27
  • 159
  • 293
6
votes
2 answers

DUnit GUI Testing: Can I force 'Application' to a different "form"?

I'm trying to run a GUI unit test with DUnit to an application whose mainform creates dynamically frames to itself. I've been able to create the application-to-test's mainform as a form in the test case and access its menu items etc. The problem…
DelphiUser
  • 419
  • 4
  • 12
6
votes
3 answers

How can I test functions and procedures as they don't belong to classes in Delphi?

I have several little functions in an old Unit called Utils.pas. Now I'd like refactoring some of them, but I think it's better to write test before. With DUnit I think it's impossible without a class. So I'd like to know how can I test them before…
Daniel Grillo
  • 2,368
  • 4
  • 37
  • 62
6
votes
2 answers

What kind of test cases can we write using DUnit?

I am using Delphi 7. I am new to DUnit, my doubt is what kind of test cases I can write using DUnit and how (that is very important for me). Is it possible to write test cases for a particular button click event? Because in that event there may be a…