Catch2
Catch2 copied to clipboard
Improve --durations output format for nested sections
Current behaviour
Consider the following test structure:
TEST_CASE("TestCase-1")
SECTION("Section-1")
SECTION("Nested-1")
SECTION("Nested-2")
SECTION("Section-2")
If I run test with --durations=yes
option, then the output looks like
1.000 s: Nested-1
1.100 s: Section-1
1.200 s: TestCase-1
2.000 s: Nested-2
2.100 s: Section-1
2.200 s: TestCase-1
1.000 s: Section-2
1.100 s: TestCase-1
The problem
I find it hard to read because of two reasons:
- All cases and sections are on the same level, I cannot see nesting unless I write prefixes by hand, e.g.
SECTION("TestCase-1::Section-1::Nested-2")
. - Several separate durations are reported for
TestCase-1
andSection-1
, which doesn't make much sense to me - usually I want to see the total time for each case/section.
Desired behaviour
Ideally I'd like to get something like this - aggregated timings with prefixes (and any reasonable separator):
1.000 s: TestCase-1::Section-1::Nested-1
2.000 s: TestCase-1::Section-1::Nested-2
3.200 s: TestCase-1::Section-1
1.000 s: TestCase-1::Section-2
4.500 s: TestCase-1