Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DUnit tests hierarchy

Tags:

delphi

dunit

Currently I am using 2-level test hierarchy in DUnit (Test Project -> Test Case -> Test method; see example below). Is it possible to introduce 3rd level or even more levels?

DUnit Example

like image 939
kludg Avatar asked Jan 16 '12 10:01

kludg


1 Answers

I build a hierarchy by putting backslashes in the `SuitePath'. For instance:

initialization

  RegisterTests('Group1\Group2', [TExampleTests1.Suite,
                                  TExampleTests2.Suite]);

  RegisterTests('Group1\Group3', [TExampleTests3.Suite,
                                  TExampleTests4.Suite]);
end.

In the end I get something like this:

Example DUnit Test Hierarchy

A lot less mucking around than with David's way, and you can spread your group definitions across disparate units.

like image 181
Nat Avatar answered Oct 01 '22 03:10

Nat