Steps throwing exceptions not reported as an error (Boost.Test)
还没有人认领这个 Issue。
评估
调研方向
定位 BoostDriver 对 runWithMasterSuite() 的调用,并检查 unit_test_monitor.ipp,其中会捕获异常并将其报告给 observer。检查 driver 如何确定 step 是否成功,并将其与 Boost.Test results_collector 的输出进行比较。当抛出异常的 step 被报告为失败而不是成功,并且失败详情对 cucumber-cpp 可用时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Summary
We encountered the issue that step definitions which throw an exception are reported as passed, when using the Boost.Test framework and cucumber-cpp.
Expected Behavior
Our expectation was that a step which throws an exception (for whatever reason) should be reported as a failed step by cucumber-cpp.
Current Behavior
The step is reported as passed. The rest of the step definition after the exception gets thrown, doesn't get executed.
Possible Solution
Not familiar with Boost.Test nor cucumber-cpp source code, but while debugging this, I noticed the following:
The exception is caught by unit_test_monitor_t::execute_and_translate(...) in unit_test_monitor.ipp and gets reported to test observers.
However, the BoostDriver only considers the test log for the decision to rate a step as success or failure, but exceptions don't show up in this log for some reason.
We could successfully trigger a failed step by adding something along the following lines after runWithMasterSuite() (needs #include <boost/test/results_collector.hpp>):
auto results = ::boost::unit_test::results_collector.results(testCase->p_id);
if (!results.passed())
{
std::string description = "Test aborted/failed with result code " + std::to_string(results.result_code());
return InvokeResult::failure(description.c_str());
}
- 主要语言
- C++
- 星标
- 330
- 派生
- 142
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cucumber/cucumber-cpp 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
cucumber/cucumber-cpp#317 ·
-
难度 5/5 一周以上 新手友好度 20/100
cucumber/cucumber-cpp#313 · 9 条评论 ·
-
Authorize hyphen "-" for Tag可能重新可做 @ursfassler 于 399 天前认领,目前没有进行中的 PR。 未关闭bug
cucumber/cucumber-cpp#312 · 4 条评论 · 已指派 1 人 ·
-
feature
难度 4/5 3-5 天 新手友好度 35/100
cucumber/cucumber-cpp#304 · 2 条评论 ·
-
help
难度 4/5 3-5 天 新手友好度 25/100
cucumber/cucumber-cpp#302 · 1 条评论 ·
查看 cucumber/cucumber-cpp 的全部 Issue
相似的 Issue
-
Build fails on macOS 27: dyld refuses stripped Rust proc-macros (mis-aligned LINKEDIT string pool)未关闭
难度 2/5 1-3 小时 新手友好度 73/100
cloudflare/workerd#8963 ·
维护者通常 1 天内回复
-
Android Bug Core Drape
难度 2/5 1-3 小时 新手友好度 77/100
organicmaps/organicmaps#14449 ·
维护者通常 1 天内回复
-
comp-codecs
难度 2/5 1-3 小时 新手友好度 84/100
ClickHouse/ClickHouse#135159 ·
维护者通常 1 天内回复
-
category:port-update
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 2 天内回复
-
difficulty:easy func:python os:windows prio:high type:bug
难度 2/5 1-3 小时 新手友好度 78/100
NatronGitHub/Natron#2029 ·
维护者通常 1 天内回复