[asterisk-dev] Asterisk additions to support Asterisk Test Suite for 1.8

Paul Belanger pabelanger at digium.com
Mon Aug 22 15:37:45 CDT 2011


On 11-08-22 03:18 PM, Matthew Jordan wrote:
> Hello -
>
> As a part of enhancing the Asterisk Test Suite, we've come up with a mechanism in Asterisk to notify tests through AMI of events that occur in an application.  The need for this came from two observations:
>
> 1. Some tests may report false errors due to their inherent timing driven nature.  For example, currently, in an application that has a built in playback of an audio 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.  When a test has two Asterisk instances, running on a single core machine, the tight timing constraints imposed by this scenario can mean that the Asterisk instances will become out of sync with what the test developer expected, and the test can arbitrarily fail.  This situation arises often 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 also 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.
>
> A new AMI event, TestEvent, has been added that allows applications to send information to the test suite during test execution.  Hence, a test can wait to be notified of an event completing before taking additional actions.  The TestEvent, much like the UserEvent, allows arbitrary data to be sent to the receiving party.  This allows a test developer to handle most conceivable situations that Asterisk applications will throw at them.
>
> This patch will be going into 10 and trunk.  However, we would also like to apply this patch to the 1.8 branch, to assist us in better supporting and testing the Asterisk branches currently being maintained.  Our concern with applying this to 1.8 is that the TestEvent will alter existing applications.  We've taken steps to prevent this from having any impact by only enabling the TestEvent if the TEST_FRAMEWORK compiler flag (which can only be enabled in dev-mode) is turned on.  By default, all statements related to the TestEvent are macro'd out if the TEST_FRAMEWORK compiler flag does not exist.
>
> Normally we do not apply new features to older branches; however, as this can greatly help us in testing and maintaining this branch, we'd like to make an exception.  Please let us know if you feel there are any issues with this feature going into the 1.8 branch.
>
Personally, I'd like to see this added into Asterisk 1.8. So it gets my 
vote.

Good work BTW

-- 
Paul Belanger
Digium, Inc. | Software Developer
twitter: pabelanger | IRC: pabelanger (Freenode)
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list