Unit testing dial plans?

3 views
Skip to first unread message

harry

unread,
Apr 10, 2008, 3:32:42 AM4/10/08
to Adhearsion
Hello

I just recently started unit testing my ruby stuff, works wonder. But,
how do I test my Adhearsion dial plans? If someone could share a
simple test or so, to get me started.

Thanks,
Harry

Justin Grammens

unread,
Apr 15, 2008, 11:50:39 AM4/15/08
to adhea...@googlegroups.com
Hi Harry,
I have been wondering the same thing myself, as always write unit and integration tests for my web applications. It seems like doing actual "integration" tests with your dial plan are a bit difficult to assert since the true response is audio to the user. I don't have any quick answers, but here's some initial thoughts I have had.

1. The brute force method would be to script something to place the call, capture the audio response and assert it's what you are expecting.
2. Look at some way to use mocking in your tests to assert various paths in your dialplan.rb were called.
3. Script a phone call and write out flags in test mode to a database or persistent storage in your dialplan and assert those values are being written from your tests.
4. Other options?

I wish I had a good answer. Option #2 is probably the best if it can be done. Some type of a testing framework for adhearsion dialplans might be a candidate for a side project? ;)

Justin

Tim Uckun

unread,
Apr 18, 2008, 9:44:19 AM4/18/08
to adhea...@googlegroups.com
> 2. Look at some way to use mocking in your tests to assert various paths in
> your dialplan.rb were called.


for most applications all you are doing is sending in keys and
listening to sounds right? Why not mock something that instead of
playing a wave file just returns the path to the wave file. The test
can be some like.

s = sendkey 1
assert_equals s, '/var/lib/sounds/en/you_pressed_the_wrong_key'
s= sendkey 2
assert_equals s, '/var/lib/asterisk/sounds/en/you_pressed_the_right_key

Anyway you get the idea.

Reply all
Reply to author
Forward
0 new messages