catchorg / catchorg/Catch2

Add SET_UP and TEAR_DOWN or similar macros to the Catch framework

Open
#815 3 comments 1 reaction 0 assignees View on GitHub
Feature Request
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

Would it be possible to add a global set up and tear down macros to the Catch?

Today this is possible to do in the custom main, but it would be much more useful to do it in a similar way as we write TEST_CASES so I can do CHECKS and REQUIRE in the SET_UP.
The advantage is that if SET_UP fails then 1. you get a report of that in the reporter output, 2. test cases would not run in that case.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how custom main currently provides global setup and teardown, then trace the Catch framework lifecycle and TEST_CASE registration. Determine how SET_UP and TEAR_DOWN-style macros could run CHECK and REQUIRE before test cases, report failures, and prevent test execution when setup fails. Done means the behavior is specified and covered by framework tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.