0

when I build and run a cpputest I get output like:

TEST(MYTEST, TEST_CASE_1) - 0 ms
TEST(MYTEST, TEST_CASE_2) - 0 ms
TEST(MYTEST, TEST_CASE_3) - 0 ms

This is by specifying the command line argument -v (verbose) Is there a way to put more information within the output. I would like for each Unit Test case to have a specific ID, like:

TEST(MYTEST, TEST_CASE_1) - 0 ms - ID:001
TEST(MYTEST, TEST_CASE_2) - 0 ms - ID:002
TEST(MYTEST, TEST_CASE_3) - 0 ms - ID:003

I found the UT_PRINT() macro but it outputs the complete path to the Unit test file with the line number. This ID Number I would to output later to .xml file using

-ojunit 

command.

Any idea?

JohnDoe
  • 825
  • 1
  • 13
  • 31
  • I'm not familiar with cpputest, but isn't the reporter a separated module, which can be replaced by your own one, like in [UnitTest++](http://unittest-cpp.github.io/) / [TestReporter.h](https://github.com/unittest-cpp/unittest-cpp/blob/master/UnitTest%2B%2B/TestReporter.h)? – Ped7g Sep 19 '16 at 14:06
  • Are you sure you want to add ID's to your tests? Be aware that ID's will change between TDD cycles, where tests are incremented. There's no way you can define the order the tests are run nor predict it, it is platform dependent. – Felipe Lavratti Nov 29 '16 at 16:42
  • @JohnDoe did you ever get a functional answer to this? – i_am_human_probably Aug 12 '23 at 19:31

1 Answers1

0

You can implement any output format you need by implementing a TestOutput (also check CompositeTestOutput, TeamCityTestOutput and JUnitTestOutput.

ollo
  • 24,797
  • 14
  • 106
  • 155