This folder contains the DUnitX test suite for Bold for Delphi
(2100+ tests). The test projects require two external frameworks that
are not part of this repository - if you just tried to build
UnitTest.dproj and got
F2613 Unit 'DUnitX.Loggers.Console' not found
F2613 Unit 'Delphi.Mocks' not found
this README is for you. Nothing in Source/ needs these frameworks;
they are test-only dependencies.
| Dependency | Environment variable | Purpose |
|---|---|---|
| DUnitX | DUnitX |
Unit testing framework |
| Delphi-Mocks | DelphiMocks |
Mocking framework for interface testing |
The .dproj search paths reference them as $(DUnitX) and
$(DelphiMocks). Each variable must point to the framework's Source
subfolder.
cd UnitTest
.\setup-tests.ps1This clones both frameworks next to the repository and sets the two environment variables (user level). Restart the Delphi IDE afterwards - it reads environment variables at startup.
-
Get the frameworks, either with Git:
git clone https://github.com/VSoftTechnologies/DUnitX.git git clone https://github.com/VSoftTechnologies/Delphi-Mocks.gitor without Git — download and extract the ZIPs:
- https://github.com/VSoftTechnologies/DUnitX/archive/refs/heads/master.zip
- https://github.com/VSoftTechnologies/Delphi-Mocks/archive/refs/heads/master.zip
(A ZIP extracts to a folder named
DUnitX-master/Delphi-Mocks-master— rename or just point the variables at the actual folder.) -
Set the variables, either as Windows user environment variables or in the Delphi IDE under Tools > Options > IDE > Environment Variables. Each variable must point to the framework's
Sourcesubfolder:DUnitX=<path>\DUnitX\SourceDelphiMocks=<path>\Delphi-Mocks\Source
-
Restart the IDE — it reads environment variables at startup.
-
Open
UnitTest.groupprojand build.
In the IDE: open UnitTest.groupproj (contains the console runner
UnitTest.dproj and the GUI runner UnitTestGUI.dproj) and build.
Command line:
.\build.ps1 # console runner, Debug/Win32
.\build.ps1 -GUI # GUI runner
.\UnitTest.exe # run all testsRun a specific fixture or test:
.\UnitTest.exe --run:Test.BoldUndoHandler.TTestBoldUndoHandler --consolemode:Verbose.\run_coverage.ps1Builds, runs all tests under
DelphiCodeCoverage
(expected at C:\Attracs\DelphiCodeCoverage\), and opens the HTML report
from coverage_report/. See the main README for current
statistics and Codecov upload.