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
4
votes
3 answers

DUnit Cannot create form. No MDI forms are currently active

Hey there i have a problem with my Unit Testing in Delphi XE3 i have a project that consist of 1 MDIForm and allot of MDIChild forms then problem is that when i run test on my MDIChild forms i get this error: TestAllDataSrouces:…
AirWolf
  • 597
  • 7
  • 27
4
votes
1 answer

Equivalent to Python DocTest in Delphi?

Is there any equivalent of DocTest for Delphi. I use DUnit but I like the Python DocTest idea. I saw some answer like here but I think that, for simple functions, a DocTest like could be OK. My goal is to define my tests in the comment header when I…
philnext
  • 3,242
  • 5
  • 39
  • 62
3
votes
1 answer

How to get active TGUITestRunner from DUnit test?

TGUITestRunner form represents DUnit test results and created once by GUITestRunner.RunTest procedure: procedure RunTest(test: ITest); begin with TGUITestRunner.Create(nil) do begin try Suite := test; ShowModal; finally …
Andrew
  • 3,696
  • 3
  • 40
  • 71
3
votes
3 answers

How do I determine the type of the implementing object of an interface

I'm attempting to write a unit test for a simple factory class that creates one of several possible implementing objects and returns it as an interface reference. DUnit has a built in procedure, CheckIs(AObject: TObject; AClass: TClass; msg:…
Kenneth Cochran
  • 11,954
  • 3
  • 52
  • 117
3
votes
1 answer

Dunit console mode - Executing tests twice

I have a dunit test project and I am trying to run it in console mode. When I execute the project it runs twice (it opens only one console window and I see it executing twice the tests) and it is also taking much more time to execute than when I run…
Rafael Colucci
  • 6,018
  • 4
  • 52
  • 121
3
votes
0 answers

Why are unittests crashing when running from `local system` account?

Observed I have a Jenkins build job that runs on a Windows slave. The slave has MSBuild set up properly and is running Windows Server 2012R2 Standard x64. That build job is compiling and running the Unittests for my project. The tests are using…
HaMster
  • 533
  • 1
  • 6
  • 17
3
votes
2 answers

Create list of test dynamically

i use DUnitX in Delphi but i got stuck. How can i create list of tests dynamically? e.g. i have list of sql and need to test them all like for i:= 0 to List.Count do begin AddTest(List[i].SQL, List[i].Info, List[i].MaxTime); end; for one…
Livius
  • 958
  • 1
  • 6
  • 19
3
votes
2 answers

Delphi 7, FastMM and DUnit GUITesting failing tests with false memory leaks

I've had some problems with FastMM false positives. This time, the leaks are in the cases testing forms. It's very similar to the one I described here. I got a form and some plain old VCL controls in it. The first test run shows leaks which, in…
3
votes
4 answers

Delphi 7, DUnit and FastMM reporting Strings incorrectly

I'm using DUnit and FastMM to catch unfinalized memory blocks but there seems to be a Bug. I dunno if its in FastMM, DUnit or in Delphi itself, but here goes: When my Test Case has internal strings, the test fails with memory leaks. If I run the…
3
votes
1 answer

How to unit test third-party email components in Delphi?

I'm writing some new code that involves POP3 manipulation. I'm trying to come up with a design that allows me to write tests, so it's fairly decoupled and exercises most of the new code I'm writing. The problem I'm facing is that I still need to…
Leonardo Herrera
  • 8,388
  • 5
  • 36
  • 66
2
votes
0 answers

DUnit GUI test of modal window close hangs when run on TeamCity

I have been trying to do a GUI test with DUnit which includes interacting with modal windows via a message loop timer system by @tomazy (see my earlier question for more details: (How) Can I use FutureWindows with standard file open dialogs? ). My…
DelphiUser
  • 419
  • 4
  • 12
2
votes
2 answers

TIdHTTPServer raise EThread error 6 when activating it in my DUnit test

I need a local HTTP server for my unit test. When I try to activate TIdHTTPServer at SetUp, it fails with EThread message: "Thread Error: descriptor not valid (6)" This is how I initialize it: type TestMyUnit = class(TTestCase) ... procedure…
Andrew
  • 3,696
  • 3
  • 40
  • 71
2
votes
1 answer

How to break dependency to enable unittesting

I have spent much time thinking about unittesting. I have at least bought Working Effectively with Legacy Code as an EBook. Most of it make sense, it seems to be a great book about unittesting old code. But still I think I need a starting point for…
Roland Bengtsson
  • 5,058
  • 9
  • 58
  • 99
2
votes
2 answers

How to use visual components in delphi unit tests?

As is sometimes usual in visual applications, I have some code where data is maintained in a visual component (a TTreeView component). I'm refactoring the code and creating unit tests for the logic. The only visual form in my test project is the…
neves
  • 33,186
  • 27
  • 159
  • 192
2
votes
1 answer

How can I "Collapse All" Nodes in TGUITestRunner?

DUnit offers a context menu item "Expand all" and "Hide Test Nodes". In my test projects however, choosing the latter option still leaves very many test suite hierarchy nodes open. Only the test nodes on the last level are hidden. Is there a secret…
mjn
  • 36,362
  • 28
  • 176
  • 378