Repository navigation
Replies: 4 comments
|
In trading such an option is there an explicit case in test development where all the current context information already provided in the standardized format along with the flexibilities provided by UtPrintf to add additional info if needed isn't sufficient? The advantage of the standard format macros is the standard format (scriptable analysis, etc), and I don't see a huge payoff to adding more text in the standardized information that gets logged over just using UtPrintf or similar. If this is in the "nice to have" category I'd prefer to avoid adding another set of macros we have to maintain/support vs the capabilities already provided. |
|
In truth, were I to have the _WITH_DESC versions, I would not use anything else. Mostly because I believe in unit test verbosity. I just found it odd that all of these macros send "" (empty string) as the desc. This led to the thought it would be nice to have ones that could actually use that feature. I can provide my own implementations, but thought they may prove useful to others. I do not like the UtPrintf option due to additional code line and more test output: becomes while consolidating it to the one call becomes |
|
Note that in most cases, the logging of event IDs like above would generally come after asserting on the return code from a call to some function (e.g. CFE_EVS_SendEvent), such as: When reading the logs you'll see two messages, so you mostly get this context "for free" if reading the logs. I do concur that the downside of including extra free-form tags is that it makes the log output harder to digest by a script. Being able to regex-match the test log outputs has proven helpful in the past, this but depends on having a consistent formatting in the output. The extra description tag on the internal function was probably just there originally to match old/existing test outputs. In some ways, less is more in this regard, because its fixed information, not runtime state information. Priority should be to capture the runtime data that might be ephemeral (such as if it the event ID was an uninitialized value, or corrupted value, etc) so the developer who is tasked with debugging it can know that information, in case it isn't readily reproducible. The context info/function that was previously called is very obvious by opening the source file and going to the line number of the test that failed, so it is not really important to have that info directly in the log file, if its in the source file. |
|
I do not agree with the "most cases" assumption as none of my unit tests would ever look like that. My use case as I described is not a test when I am calling CFE_EVS_SendEvent, that function is called by my code under test and I am verifying what it received. I also do not agree with "less is more in this regard" because the goal of unit testing should not be the obfuscation of results, but instead clarity. Readability of results is important to me because I develop with test driven design. I am constantly running the tests as the production code is developed, but I am also concerned with coming back much later and having good outputs describing what is occurring at runtime. Again, I advocate for verbosity in unit test output. If it is not desired to give users a more verbose option here because other ways exist, then so be it. However, I still think it would be a valuable addition. Plus, maintaining these extra macros should just be a little regex work when things change. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Output is generic and some additional information is desired. e.g. Turn '*received.RunStatus (3) == *test->expected.RunStatus (3)' into 'CFE_ES_RunLoop:*received.RunStatus (3) == *test->expected.RunStatus (3)'
Describe the solution you'd like
Take each of the macros in utassert.h that are designed for these checks and add a second version that has _WITH_DESC or something of that nature.
Describe alternatives you've considered
Already written my own locally needed versions.
Additional context
As an example for UT_UNT32_EQ would look like extended:
Requester Info
Alan Gibson
NASA/GSFC 587
All reactions