[asterisk-dev] [Code Review] Unit Test Framework

Mark Michelson mmichelson at digium.com
Wed Dec 16 13:27:48 CST 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/447/#review1307
-----------------------------------------------------------



/trunk/main/test.c
<https://reviewboard.asterisk.org/r/447/#comment3025>

    IMHO, the "error" element should be a subelement or attribute of "result." This way, you don't get a whole bunch of 
    
    <error>NA</error>
    
    on your passed tests.
    
    I'm thinking more like this (spacing added for readability):
    <result>
        FAILED
        <error>
            "Paper Jam"
        </error>
    </result>
    
    or:
    
    <result error="Paper Jam">
        FAILED
    </result>



/trunk/main/test.c
<https://reviewboard.asterisk.org/r/447/#comment3026>

    Similar to the XML comment, perhaps the Error Description line should not be printed at all if the test passed.



/trunk/main/test.c
<https://reviewboard.asterisk.org/r/447/#comment3027>

    Any particular reason you used a safe traversal here? The same actually goes for several other places, too, but this is the first instance I noticed.



/trunk/main/test.c
<https://reviewboard.asterisk.org/r/447/#comment3024>

    You can reduce the indentation level of this by doing:
    
    if (test->result == AST_TEST_NOT_RUN) {
        continue;
    }
    
    /* Rest of block */


- Mark


On 2009-12-15 18:15:17, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/447/
> -----------------------------------------------------------
> 
> (Updated 2009-12-15 18:15:17)
> 
> 
> Review request for Asterisk Developers and Russell Bryant.
> 
> 
> Summary
> -------
> 
> The Unit Test Framework is a new API that manages registration and execution of unit tests in Asterisk with the purpose of verifying the operation of C functions.
> 
> The Framework consists of a single test manager accompanied by a list of registered test functions defined within the code.  A test is defined, registered, and unregistered from the framework using a set of macros which allow the test code to only be compiled within asterisk when the TEST_FRAMEWORK flag is enabled in menuselect.  This allows the test code to exist in the same file as the C functions it intends to verify.  Registered tests may be viewed and executed via a set of new CLI commands.  CLI commands are also present for generating and exporting test results into xml and txt formats.
> 
> For more information and use cases please refer to the documentation provided at the beginning of the test.h file.
> 
> 
> Diffs
> -----
> 
>   /trunk/build_tools/cflags-devmode.xml 235225 
>   /trunk/include/asterisk/test.h PRE-CREATION 
>   /trunk/main/asterisk.c 235225 
>   /trunk/main/test.c PRE-CREATION 
>   /trunk/tests/test_heap.c 235225 
> 
> Diff: https://reviewboard.asterisk.org/r/447/diff
> 
> 
> Testing
> -------
> 
> test_heap.c has been modified to take advantage of the Test Framework.  I have executed and generated reports for these tests. 
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list