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
1
vote
1 answer

Misleading memory leak on mocked method using Spring4D

I have a class TMyClass, on which I inject interface IFileManager. In this interface there is a method GetCompanyWorkbook(const ACompanyId: System.Integer; const AStream: TStream). This method fills AStream depend from ACompanyId. Everything works…
urkainian
  • 13
  • 3
1
vote
2 answers

DunitX, how to run only one test?

Everytime I run my DUnitX project, it's ran all tests. Is their a simple way to make it run only one test (The test I m working on for example)? Is it possible specify the test to run in the command line?
zeus
  • 12,173
  • 9
  • 63
  • 184
1
vote
1 answer

How to test the right way the call number of a mocked method in Spring4D 1.2.2?

My test just has to check the call number of a given mocked method, nothing else. The tested class and the embedded interface: type IMyInterface = interface ( IInvokable ) ['{815BD1B0-77CB-435F-B4F3-9936001BA166}'] procedure bar; end; …
SOLID Developper
  • 672
  • 4
  • 12
1
vote
1 answer

How can I mock a method call with var parameter in DUnitX and Spring4D 1.2.2

How can I mock an interface method call like procedure foo( var i_ : integer ). The tested method local variable passed as a var param, so the test must use Arg.IsAny (The test does not access it). The result value is not the same as the out value…
SOLID Developper
  • 672
  • 4
  • 12
1
vote
1 answer

DUNIT X , pass large number of strings

I need to pass a lot of string values to a test procedure, the string parameters are transferred as a commatext stringlist, code goes like below [test] [testcase(test1,'xxxx,yyyy,zzz, ........')] procedure Test_transmitmany strings(S1, S2, S3, …
Franz
  • 1,883
  • 26
  • 47
1
vote
1 answer

Running all testcases at once in DUnitX

I have a test with several test cases, ex: [Test] [TestCase('Case1', '1')] [TestCase('Case2', '2')] [TestCase('Case3', '3')] procedure RunTest(const aParam: integer); I can run each test case separately including test case name…
Alex
  • 23
  • 5
1
vote
0 answers

DUnitX failing to run tests (no indication it "sees" them)

I'm exploring DUnitX for the first time and rebuilding a Windows 10 calculator clone to practice test-driven development. I have three test classes (paralleling a main CalculatorLogic class, an Equation class, and an Operand class). I've written…
ildrummer
  • 21
  • 4
1
vote
2 answers

Delphi DunitX, how do I get the name of the test currently running?

How do I get the name of the test that is currently running in DunitX? For example: procedure TestModule.TestProcedure; begin Assert.Pass('This tests name is ' + TestName); end
RED MONKEY
  • 3,025
  • 2
  • 21
  • 23
1
vote
1 answer

Determining the order of the tests in DUnitX?

Execution order of RegisterTestFixture does not work. DUnitX executing test cases randomly. How do I determine execution order of the tests in DUnitX?
gDir
  • 35
  • 1
  • 6
1
vote
2 answers

How to log in DUnitX?

Using Rad Studio 10 Seattle, DUnitX and TestInsight, I would need to show some texts in the console or any log screen. How can it be done? I have not been able to find it in the web.
kokokok
  • 1,030
  • 1
  • 9
  • 26
0
votes
1 answer

DUnitX integer test always true

I have a test defined like so: [Test] [TestCase('TestSetAsInteger 001.', '0')] [TestCase('TestSetAsInteger 002.', '666')] procedure TestSetAsInteger(IntVal : integer); And Implemented like so: procedure TTestKeyValueList.TestSetAsInteger(IntVal:…
RED MONKEY
  • 3,025
  • 2
  • 21
  • 23
0
votes
1 answer

How to use Guard in place of Assert in TestInsight.DUnitX

I want to use the TestInsight.DUnitX with guard (Spring4D) but I get message 'No assertions were made during the test' Is it possible to use the guard class in place of the assert?
Ravaut123
  • 2,764
  • 31
  • 46
0
votes
0 answers

Delphi VCL Form testing using DUnitX Framework (thread problem)

I'm doing GUI testing using DUnitX framework. And I run into a problem with threads. Here is simple demonstration on demo what is the problem. My form have one button and one label. Button starts MyThread and changes label caption from 'Press start'…
Ivan
  • 85
  • 6
0
votes
1 answer

DUNITX call Setup with parameters

I guess the best practice in unit testing is writing code always called (like create object , do a primary init of these objects, .... ) for a test inside the setup procedure [TestFixture] TMY_Testcases = class private …
Franz
  • 1,883
  • 26
  • 47
0
votes
0 answers

How to know the test code coverage in Delphi?

Is there a way to know all the line of codes that was not executed during my test? Manually it's easy but terribly laborious, I put a breakpoint on the line of code, if this breakpoint fire during the test then this line of code was executed else…
zeus
  • 12,173
  • 9
  • 63
  • 184