Questions tagged [dunitx]

DUnitX is a Delphi test framework

DUnitX is a new test framework, taking ideas from DUnit, NUnit and other test frameworks. It is designed to work with Delphi 2010 or later, it makes use of language/RTL features that are not available in older versions of Delphi.

37 questions
20
votes
2 answers

Can I pass a set to a test case in DUnitX?

I'm trying to check the state of an object after running a test. This state is contained in a set. Is it possible to pass the expected state to the test case using DUnitX Attributes, so that I can use the same test for all different inputs? I tried…
Lübbe Onken
  • 526
  • 2
  • 12
6
votes
1 answer

unit testing - How can I pass string with comma to a testcase in DUnitX

If I have a unit test with string parameter, and I want to check if the input string has a comma (,) somewhere, I should create an input string with a comma in it. But how to pass it to the TestCase? [Test] [TestCase('TestA', '12,34')] …
Mattia72
  • 825
  • 1
  • 8
  • 23
4
votes
1 answer

How to enable StackTrace in DUnitX ?

I have Delphi Seattle in place and I'm using DUnitX as my test framework. I noticed that it may have support for stacktrace. But I found no example or documentation about it. I found an inc file (DUnitX.Stacktrace.inc) where I can configure what I…
Rodrigo Farias Rezino
  • 2,687
  • 3
  • 33
  • 60
3
votes
0 answers

Delphi Rio DUNITX in Gitlab CI for Android and IOS

I have set up a gitlab CI runner that compiles my DUNITX unit tests for Linux, OSX and Windows and runs them on three machines. I do not use PAClient but upoad the compiled unit test application to the machine and run it there. This works perfect…
MichaSchumann
  • 1,361
  • 1
  • 17
  • 36
3
votes
1 answer

Delphi DunitX FMX GUI logger

I have a console based DUNITX unit test program which I am trying to convert to the FMX GUI output. Having read the embarcadero docs here, I modified the Test program file by doing the following: included the DUnitX.Loggers.GUIX unit Commented out…
cheechaway
  • 101
  • 1
  • 10
3
votes
1 answer

When do we use Assert.Pass() in DUnitX?

It looks to me Assert.Pass("Some Message") does not do anything if I just put it in a test method: procedure TRPMTestObject.TestPlatform; begin {$IFDEF WIN64} Assert.AreEqual(8, SizeOf(Pointer)); Assert.Pass('WIN64 Defined'); {$ENDIF} {$IFDEF…
justyy
  • 5,831
  • 4
  • 40
  • 73
3
votes
1 answer

DUnitX can't work at 64-bit?

DUnitX works if i select '32-bit Windows', however, when I change it to '64-bit Windows', it says [dcc64 Fatal Error] RPMLibTestsX.dpr(14): F2613 Unit 'DUnitX.Windows.Console' not found. is this expected? I am using RAD Studio 10.1 Berlin Update…
justyy
  • 5,831
  • 4
  • 40
  • 73
3
votes
1 answer

DUnitX Conversion from string to array of integer

My question is similar to this one, but instead of a set, I'd like to pass an array of integers. Per example: [TestCase('TestAdd','[1,2,3,4];[1,2,3,4]',';')] procedure TestAdd(aValue, aResult: array of integer); Modifying the DUnitX.Utils seems…
ColinM
  • 33
  • 3
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
1 answer

Can I pass type parameters to a testcase in DUnitx?

I'm writing testcases for my FastCode project. I've written a generic tester like so: TTest = record private class var Def: System.Generics.Defaults.IComparer; class var F: FastDefaults.TComparison; strict private class…
Johan
  • 74,508
  • 24
  • 191
  • 319
2
votes
1 answer

How to test possible memory leaks caused by references after the destruction of the tested object (DUnitX, Spring4D 1.2.2)

TMyClass contains two references. A reference to an IList and a reference to IMyInterface. The mocking of IList is not necessary. The framework probably well tested, well predictable behavior, so I could see it as a Data object.…
SOLID Developper
  • 672
  • 4
  • 12
2
votes
3 answers

No log ouput when using TDUnitX.CurrentRunner.Log

I am not sure how I can output some strings into Console window using DUnitX so here is my try: unit Unit1; interface uses DUnitX.TestFramework; type [TestFixture] TMyTestObject = class(TObject) public // Sample Methods // Simple…
zac
  • 4,495
  • 15
  • 62
  • 127
2
votes
3 answers

SetUp is not called in DUnitX in Rad Studio

I have built the example for DUnitX for Rad Studio Berlin in C++. The code is a copy of : http://docwiki.embarcadero.com/RADStudio/Seattle/en/DUnitX_Overview The header is: class __declspec(delphirtti) TestCalc : public TObject { public: …
kokokok
  • 1,030
  • 1
  • 9
  • 26
2
votes
1 answer

Can I create a common setup routine for all fixtures in a namespace in dunitx?

Is it possible to use namespaces in dunitx in such a way that all test fixtures under a namespace are enclosed by one pair of setup/teardown routines? (Similar to the SetupFixture attribute in nunit,…
2
votes
1 answer

Delphi Unit Testing : Writing a simple spy for the CUT

I'm searching for a way to easily and concisely write a spy for the DUnitX testing framework under Delphi. In the past, I've used very ugly ways of doing that using : [TestFixture] Test = class(TObject) public [test] procedure…
Ludovic C
  • 2,855
  • 20
  • 40
1
2 3