Provide means to obtain current test case name and current section name

オープン
#2,859 コメント 4 件 リアクション 8 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
cpp
領域
testing-qa

調査の方向性

まず、非推奨の Catch::getResultCapture().getCurrentTestName() パスと、アクティブなセクショントラッカーを使用する提案された RunContext 実装を確認します。現在のテスト名とセクション名がどのように表現されているかを追跡し、テスト名とセクション名に安定したアクセス方法を定義します。可能であれば階層もサポートします。完了の条件は、非推奨の API に依存せずに要求された名前を利用でき、適切なテストでカバーされていることです。

索引モデルが issue の本文から書いたものです。

説明

Description

I propose the following changes:

  • Add a feature to get the current test case's name
  • Add a feature to get the current section's name
  • Optionally: Add a feature to get the current section's hierarchy of names

These changes are useful if additional data for testing is loaded from or written to a filesystem. Directories and filenames could depend on the current section and thereby reduce duplication.

Additional context

In the past sometimes requests for these features were made but none ever reached a stable upstream (or non-deprecated) state. Especially the issue https://github.com/catchorg/Catch2/issues/510 (by @mlogan) contained a request for such features. However, it was resolved since workarounds were available.

Feature to get the current section's hierarchy of names

In the issue https://github.com/catchorg/Catch2/issues/510 @jgm-radez suggested (and @isidore supported) the following approach to obtain the current section's hierarchy of names:

virtual std::vector<std::string> getCurrentSectionNames() const {
            std::vector<std::string> retval;
            for(std::vector<ITracker*>::const_iterator iter=m_activeSections.begin(); iter!=m_activeSections.end(); ++iter)
                    retval.push_back((*iter)->nameAndLocation().name);
            return retval;
}

(Assumption: implemented in RunContext)

Feature to get the current test case's name

This feature is currently available in Catch2 but it was marked as deprecated in commit 57c346a by @philsquared and I could not find a reason for it. Why was this done?

Catch::getResultCapture().getCurrentTestName();

主要言語
C++
スター
21.6k
フォーク
3.4k
平均マージ
3日 12時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

catchorg/Catch2 のほかの issue

catchorg/Catch2 の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。