#3099

Print the active section/generator selection

Openjtunhagopened 5mo ago

Description I sometimes find it hard to correctly select the section and/or generator when digging through failing tests. A part of this is that Catch2 provides very little info about what I have actually selected with the given options.

I would like the whole test spec to be printed, just like it is when no path/section spec is given. I would also like the given filter/generator selection to be printed, just like the Filters: printout.

I'm currently using Catch2 v3.14.0.

Additional context This is the complete printout I currently get when I've made a selection that leads nowhere, which doesn't help me find out what I need to change to reach the expected assertion.

Filters: "Scenario: Create and train model on entire dataset"
Randomness seeded to: 3221299838
===============================================================================
test cases: 1 | 1 passed
assertions: - none -

Activity

4
ShivaPriyanShanmuga4mo ago

I’d like to work on this issue if it’s still open. Could you assign it to me?

ShivaPriyanShanmuga4mo ago

Hi @jtunhag, I've opened a PR that addresses this: #3165

When a section/generator selection (-c, -g, or -p) is active, the console and compact reporters now print it on a Path filters: line right below the existing Filters: line:

Filters: "Scenario: Create and train model on entire dataset" Path filters: c:"Given: a fresh dataset" Randomness seeded to: 3221299838 Section filters show as c:"" and generator filters as g:, mirroring the -p/--path-filter syntax — so it's clear exactly what you've selected, even when a combination ends up running no assertions. Would appreciate your feedback! :)

jtunhag4mo ago

Nice! Personally, I'd prefer more verbose output, spelling out "Section: " and "Generator: " instead of "c" and "g". It's meant to be read, after all. Maybe even output as a list, e.g.

Filters: "Scenario: Create and train model on entire dataset"
Path filters: 
  - Section: "Given: a fresh dataset"
  - Generator: "Something..."
ShivaPriyanShanmuga4mo ago

hmm yea! agreed that it should read naturally. I've updated the PR to spell it out as a labelled list:

Filters: "Scenario: Create and train model on entire dataset"
Path filters:
  - Section: "Given: a fresh dataset"
  - Generator: "0"

Filters are listed one per line in the order specified. Let me know if this looks good. Thanks! :D