Print message on XML file

2007-09-14
2012-10-25
  • Kevin Bianchi

    Kevin Bianchi - 2007-09-14

    Hi,

    I have a question ore a notice:

    Can we put some message in the XML file? I wan't to do this to make the XML more readable.

    (e.g. this next file is the result of a CUnit Test)

    Running Suite Driver_RT1553
    Running test RT1553_read_rx_sa ... Passed
    ADD SOME COMMENTS HERE!
    TEST VALUE BIGGER
    Running test RT1553_read_sync_dw ... Passed
    Running test RT1553_write_tx_sa ... Passed

    Cumulative Summary for Run
    Type Total Run Succeeded Failed
    Suites 1 1 - NA - 0
    Test Cases 3 3 2 1
    Assertions 135 135 134 1

    My question is can we add the two line (ADD SOME COMMENTS HERE! and TEST VALUE BIGGER) in the XML file with a CUnit function?

    If this is not available, it would be nice to put it in the next version.

    Thank You.

    Kevin

     
    • Jef Capu

      Jef Capu - 2008-08-14

      Hi,

      I guess I'm also interested in this kind of feature.

      Personally, I'd like to be able to :

      1) Get the actual value of the CU_ASSERT_EQUAL family assertions in the report.
      2) Improve the CU_PASS and CU_FAIL to support format strings like printf
      3) As you wish Kevin, have a CU_COMMENT primitive to add arbitrary text in CUnit results.
      4) Add setup and teardown functions, called for each test case, not only for suites.

      The last version of CUnit is rather aged. Is there still developers working on it ?

      Anyway, I project to try to implements this functionality.
      Anybody interested to help, in any manner ?

      good night.

      Jef

       
      • Phil

        Phil - 2008-09-16

        Hi Jef,

        I agree with you, especially on 1), and also 4) as a bonus.

        Again, are there still developers on it? I'd be willing to help, time permitting, on these two items.

        Thanks,

        Phil

         
        • Phil

          Phil - 2008-09-17

          FYI, here's a quick 'hack' I came up with, that works for my purposes to address point 1).
          Suggestions are welcome.

          Phil

          /* Total condition string size to get the actual/expected values in failure reports.
          * May be user-tuned -- it goes on the stack of the caller.
          /

          define CU_ASSERT_EQUAL_STRLEN_STACK 128

          define CU_ASSERT_EQUAL(actual, expected) \

          { \ char str[CU_ASSERT_EQUAL_STRLEN_STACK]; \ snprintf(str, CU_ASSERT_EQUAL_STRLEN_STACK, \ "CU_ASSERT_EQUAL(%s '0x%x', %s '0x%x')", #actual, actual, #expected, expected); \ CU_assertImplementation(((actual) == (expected)), \ LINE, str, FILE, "", CU_FALSE); \ }

          define CU_ASSERT_STRING_EQUAL(actual, expected) \

          { \ char str[CU_ASSERT_EQUAL_STRLEN_STACK]; \ snprintf(str, CU_ASSERT_EQUAL_STRLEN_STACK, \ "CU_ASSERT_STRING_EQUAL(%s '%s', %s '%s')", #actual, actual, #expected, expected); \ CU_assertImplementation(!(strcmp((const char)(actual), (const char)(expected))), \ LINE, str, FILE, "", CU_FALSE); \ }

           
      • Phil

        Phil - 2008-09-17

        Hi,

        for 2), I added this:

        define CU_PRINTF(format, args...) \

        { \ char str[CU_ASSERT_EQUAL_STRLEN_STACK]; \ snprintf(str, CU_ASSERT_EQUAL_STRLEN_STACK, "CU_PRINTF("format")", ## args);\ CU_assertImplementation(CU_FALSE, LINE, str, FILE, "", CU_FALSE); \ }

        Comments are welcome.

        Phil

         
    • Kevin Bianchi

      Kevin Bianchi - 2007-09-14

      The code below has just an error (here the correction):

      Cumulative Summary for Run
      Type Total Run Succeeded Failed
      Suites 1 1 - NA - 0
      Test Cases 3 3 3 0
      Assertions 135 135 135 0

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks