boostorg / boostorg/test

Data driven test cases: customizing test names and decorators

Open
#277 3 comments 4 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
213
Forks
149
Avg merge
18h 17m
Merged PRs (30d)
2

Description

Hi,

Is it possible to customize the test names generated by the data-driven test case macros (`BOOST_DATA_TEST_CASE`)? In Google Test, you can do:

```
INSTANTIATE_TEST_SUITE_P(InstantiationName, TestSuiteName, Values(
/* dataset here */
), test_name_generator);
```
Where `test_name_generator` is a function that takes as argument a wrapped sample and returns a string with the name the test should have. That replaces the "_0", "_1"... generated by default. So your test names would be something like:
- `InstantiationName/TestSuiteName/Name1`
- `InstantiationName/TestSuiteName/Name2`

Assuming `test_name_generator` would return `Name1` and `Name2` for the two samples of the dataset.

Is there something similar available in Boost.Test? If there is not, what would be the equivalent using manual test registration? All these tests do use fixtures. I would also need to apply different labels depending on the sample.

Many thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.