🤔 What's the problem you've observed?
current_test_info() is null in HOOK_AFTER_SCENARIO
Hi,
I'm using cucumber-cpp and noticed that ::testing::UnitTest::GetInstance()->current_test_info() returns nullptr inside HOOK_AFTER_SCENARIO().
Example:
HOOK_AFTER_SCENARIO()
{
const auto* test_info =
::testing::UnitTest::GetInstance()->current_test_info();
if (test_info) {
std::cout << test_info->name() << std::endl;
} else {
std::cout << "test_info is null" << std::endl;
}
}
The hook is executed correctly, but test_info is always nullptr.
My goal is to obtain the current scenario/test name during HOOK_AFTER_SCENARIO() for reporting purposes.
Is this expected behavior?
If so, could you please advise what the recommended way is to retrieve the current scenario name from within HOOK_AFTER_SCENARIO()?
Thanks!
✨ Do you have a proposal for making it better?
No response
📚 Any additional context?
No response
🤔 What's the problem you've observed?
current_test_info() is null in HOOK_AFTER_SCENARIO
Hi,
I'm using cucumber-cpp and noticed that ::testing::UnitTest::GetInstance()->current_test_info() returns nullptr inside HOOK_AFTER_SCENARIO().
Example:
HOOK_AFTER_SCENARIO()
{
const auto* test_info =
::testing::UnitTest::GetInstance()->current_test_info();
}
The hook is executed correctly, but test_info is always nullptr.
My goal is to obtain the current scenario/test name during HOOK_AFTER_SCENARIO() for reporting purposes.
Is this expected behavior?
If so, could you please advise what the recommended way is to retrieve the current scenario name from within HOOK_AFTER_SCENARIO()?
Thanks!
✨ Do you have a proposal for making it better?
No response
📚 Any additional context?
No response