boostorg / test

The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
http://boost.org/libs/test
Boost Software License 1.0
182 stars 141 forks source link

Missing formats for --list_content #397

Open fsimonis opened 1 year ago

fsimonis commented 1 year ago

There are currently 2 formats for --list_content:

  1. The human-readable format, great visually finding a test
  2. The dot format, great for visualizing the test-suite

Over the years, I found 2 formats to be missing:

List of test-cases

For simple tools or integration with external test runners like CTest, it would be super useful to have an output listing all testcases in an easy to consume way:

testsuite1/testcase1
testsuite1/testcase2
testsuite2/testcase3

Generating this information from the existing formats is rather tedious.

Use cases:

Detailed machine-readable output

For advanced tools, a detailed dump of the test tree would be useful. JSON would be suitable as it can easily be generated without special libraries.

{
  "type": "suite",
  "name": "testsuite1",
  "fileName": "...",
  "fileLine": 21,
  "labels": [],
  "children": [
    {
      "type": "case",
      "name": "testcase1",
      "fileName": "...",
      "fileLine": 23,
      "labels": []
    },
    {
      "type": "case",
      "name": "testcase2",
      "fileName": "...",
      "fileLine": 33,
      "labels": []
    }
  ]
}

The DOT format includes some of this information in a less structured way as most of it is encoded in the label.

Use cases: