DUnitX is a new test framework, taking ideas from DUnit, NUnit and other test frameworks. It is designed to work with Delphi XE2 or later, it makes use of language/RTL features that are not available in older versions of Delphi.
Version 2.0 changes some behaviour, so an existing test suite can report differently after an upgrade. For example, [TestCase] names its cases from their values, [TestCase] data that does not convert now errors the test, and --run matches whole name segments. Read BREAKINGCHANGES.md before you upgrade.
New in 2.0:
- Fixtures can run in parallel (
-m:x, Delphi 11 or later). - An optional rich console logger,
TDUnitXRichConsoleLogger(Delphi XE3 or later). It shows what each worker thread is running, a progress bar with live pass/fail counts, and a failure report at the end. It uses the VSoft.AnsiConsole DPM package, so it is not part of the runtime packages. See Docs/Rich-Console.md.
- Any class can contain tests
- Attribute based testing
- An extensive Assert Class
- Setup and TearDown per test method and per test fixture.
- API Documented using Xml-Doc
- Console Based Runner
- optional rich console logger with a live view of parallel runs (see Docs/Rich-Console.md)
- XML Logging
- produces output compatible with NUnit (compatible with CI servers like ContinuaCI)
- produces output compatible with JUnit (compatible with Gitlab CI)
- Cross platform currently supporting:
- Win32,Win64 and OSX Compilers.
- Limited backwards compatibility with DUnit test classes.
- Wizard for creating new tests.
This is far from a complete list, but a few planned features are listed here to help indicate future direction.
GUI Test Runner- Use TestInsightMulti-threaded tests- done.- Data driven test cases - the ability to provide a test method with a data source and test each entry in the data source. The data source will be virtualised so it can be anything (text file, db table etc).
- FMX / mobile: there is no console app on Android/iOS. Use
DUnitX.Loggers.Console.FMX(DUnitX.Loggers.Console.FMX.Run) as a console stand-in that streams results to an in-app memo. This is not a GUI test explorer; for IDE workflows use TestInsight. See Docs/FMX-Pseudo-Console.md. - Rich console:
DUnitX.Loggers.Console.Rich(TDUnitXRichConsoleLogger) can replace the console logger. It shows a live footer with one row per worker thread, a progress bar with live counts, and a failure report at the end, and it falls back to plain lines when the output is redirected. It needs the VSoft.AnsiConsole DPM package and Delphi XE3 or later, so it is not part of the runtime packages. See Docs/Rich-Console.md. - In order to workaround the Delphi XE3 Bug, you need to add the unit DUnitX.Init to your test projects.
- To use this GitHub version of DUnitX in place of the bundled version included with RAD Studio, it’s pretty simple by following these steps (as the bundled version is quite a few commits behind this repo):
- Remove the Embarcadero Unit test package (DUnitXIDEExpertXXX.bpl) from the installed packages list.
- In the cloned repo, open DUnitX_IDE_Expert_XXXX.dproj (matching your Delphi version), compile and install the package.
- In your unit test projects, adjust your search paths to point to the repo\Source folder.
A Delphi Praxis Forum has been setup to discuss DUnitX.
A recent list of contributors can always be obtained on GitHub.
Apache Version 2.0
Copyright (C) 2012+ Vincent Parrett
vincent@finalbuilder.com
http://www.finalbuilder.com
See license.txt for details.