[asterisk-dev] [Code Review]: New TestEvent AMI event

mjordan reviewboard at asterisk.org
Fri Aug 19 10:16:04 CDT 2011



> On Aug. 19, 2011, 9:37 a.m., Paul Belanger wrote:
> > /branches/1.8/apps/app_voicemail.c, lines 7646-7647
> > <https://reviewboard.asterisk.org/r/1364/diff/2/?file=18487#file18487line7646>
> >
> >     one line.

Fixed


> On Aug. 19, 2011, 9:37 a.m., Paul Belanger wrote:
> > /branches/1.8/apps/app_voicemail.c, line 10135
> > <https://reviewboard.asterisk.org/r/1364/diff/2/?file=18487#file18487line10135>
> >
> >     red blob since we are here

Fixed.

I will say that the more test statements I put in, the more of these you'll see - app_voicemail does not follow the coding guidelines well at all.  I'd prefer not making a ton of coding guideline fixes to code statements I'm not modifying, as that may be better covered by another effort.

Code statements that I do modify are, of course, fair game :-)


> On Aug. 19, 2011, 9:37 a.m., Paul Belanger wrote:
> > /branches/1.8/apps/app_voicemail.c, lines 10239-10242
> > <https://reviewboard.asterisk.org/r/1364/diff/2/?file=18487#file18487line10239>
> >
> >     brackets since we are here

Fixed, but as you can see from the patch, this turned into another 4 or 5 fixes.  We need to be careful not to turn this into a coding guideline patch.


- mjordan


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


On Aug. 19, 2011, 10:15 a.m., mjordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1364/
> -----------------------------------------------------------
> 
> (Updated Aug. 19, 2011, 10:15 a.m.)
> 
> 
> Review request for Asterisk Developers, David Vossel and Paul Belanger.
> 
> 
> Summary
> -------
> 
> This review is part 1 of 2.
> 
> Previously, when attempting to write tests for complex applications, tests run into two problems:
> 
> 1. The tests become inherently timing driven.  For example, in an application that has a built in playback of a voice file, the test must use Wait(n) or some other sleep mechanism and attempt to wait until the voice prompt is finished before taking action.  This can be even more difficult in those applications that have built in menus whose prompts can change based on the state of the application, such as app_voicemail's VoiceMailMain application.
> 
> 2. Applications whose success is a hangup result can be difficult to verify.  While UserEvent can be used in a dialplan to check certain return paths (thus determining whether an application definitely failed), it becomes difficult to say whether or not an application succeeds.  For example, Dial has multiple success paths where the caller is hung up on; however, the hang up could also be an error in the dialplan.  The only verification mechanism is by inspection.
> 
> The TestEvent manager event attempts to solve these two problems.  It allows a developer to raise a manager event within an application that notifies the Asterisk Test Suite that something has happened in the application.  Currently, this is one of two notifications:
> 1. A generic change in application state
> 2. A failure in an assert, indicating an off nominal condition
> 
> Both of these statements are macros that evaluate to nothing if the TEST_FRAMEWORK compilation flag is not defined, meaning they should have no impact on non-developer compiled code.  While placing the manager events in the code perturbs the units under test, the methods are fairly small, and, in the context of sending audio over a channel for several seconds, are relatively small in terms of timing.
> 
> Part 2 of this review (1363) demonstrates a test in the Asterisk Test Suite using this new event.  This diff also includes some initial hooks using the TestEvent in app_voicemail's VoiceMailMain application - I expect to add additional hooks as further tests are developed (the current ones check some of the nominal paths and operations)
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/configs/manager.conf.sample 331633 
>   /branches/1.8/include/asterisk/manager.h 331633 
>   /branches/1.8/include/asterisk/test.h 331633 
>   /branches/1.8/main/app.c 331633 
>   /branches/1.8/main/file.c 331633 
>   /branches/1.8/main/manager.c 331633 
>   /branches/1.8/main/test.c 331633 
>   /branches/1.8/apps/app_voicemail.c 331633 
> 
> Diff: https://reviewboard.asterisk.org/r/1364/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> mjordan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110819/4c2f16aa/attachment-0001.htm>


More information about the asterisk-dev mailing list