catchorg / catchorg/Catch2

Print values of generated variables on uncaught exceptions

Open
#2,667 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

**Description**
When running data driven tests I'd find very useful to quickly understand which of the values generated by `GENERATE` produced an unexpected exception. It would then be useful to print these values in the report if possible, e.g.:

```
Scenario: Testing the GGSScdHitsReader against the GGS reader on ParametricGeo
Given: A GGS output file, a GGSScdHitsReader and a GGS reader
-------------------------------------------------------------------------------
/home/mori/analysis/HERD/HerdSoftware/testsuite/unit/dataproviders/readers/event/testGGSScdHitsReader.cpp:10
...............................................................................

/home/mori/analysis/HERD/HerdSoftware/testsuite/unit/dataproviders/readers/event/testGGSScdHitsReader.cpp:10: FAILED:
{Unknown expression after the reported line}
due to unexpected exception with message:
IntHits missing for detector topFitMatCore

Values of generated variables:
- foo =value1
- bar = value2
```

**Additional context**
Currently using Catch v2.13.8

Contributor guide

Open the contributing guide

Research direction

Start by tracing Catch v2.13.8's handling of uncaught exceptions during data-driven tests and how GENERATE values are retained for reporting. Reproduce the unexpected-exception case, then verify that the report includes each generated variable and its value without changing existing failure output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.