GeezerVison is showing github.com — Add TEST_PROPERTY macro for JUnit per-test-case properties by thetic · Pull Request #1884 · cpputest/cpputest
Conversation
thetic
commented
Apr 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- Adds
TEST_PROPERTY(name, value) (C++) and TEST_PROPERTY_C(name, value) (C) macros that attach key-value string properties to the current test case
- Properties appear as
<properties><property name="..." value="..."/></properties> inside the <testcase> element in JUnit XML output (standard JUnit XML format); the block is omitted entirely when no properties are set
- Property names and values are XML-encoded
The feature routes through the existing UtestShell → TestResult → TestOutput call chain: JUnitTestOutput overrides printTestProperty to store properties on per-test-case result nodes and emit them when writing XML. All other TestOutput subclasses get a default no-op, but the feature is available to extend existing or future output implementations.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sillocan reacted with thumbs up emoji
Adds TEST_PROPERTY(name, value) for C++ and TEST_PROPERTY_C(name, value)
for C, allowing test bodies to attach key-value metadata that appears in
JUnit XML output as <property> elements inside <testcase> blocks.
Properties flow through the existing UtestShell -> TestResult ->
TestOutput call chain, with JUnitTestOutput storing them on per-test-case
result nodes and emitting them when writing XML. The <properties> block
is only emitted when at least one property is present. Property names and
values are XML-encoded.
Adds a PropertySpyOutput that captures printTestProperty calls, and two
tests that drive the macros through ExecFunctionTestShell with a spy
result to verify the full routing chain from macro invocation to output.
Also adds the cpputest_test_property_c_caller helper in the C test file
to exercise TEST_PROPERTY_C from actual C code.
Fixes -Wmissing-prototypes error with clang-cl -Werror.
coveralls
commented
Apr 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

coverage: 99.285% (+0.004%) from 99.281%
when pulling 976c4b8 on thetic:feature/test-property
into 79c066e on cpputest:master.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
We don't need a macro that just forwards to a function.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.