Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Testing Adhearsion Applications

577 views

Published on

Testing Adhearsion Applications presented by Luca Pradovera at AdhearsionConf 2012

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Testing Adhearsion Applications

  1. 1. TESTING ADHEARSION APPLICATIONS Luca  Pradovera Voice  Applica1on  Developer Mojo  Lingo  LLCvenerdì 1 marzo 13
  2. 2. About me - Rubyist from Italy - Voice Application Developer at Mojo Lingovenerdì 1 marzo 13
  3. 3. ADHEARSION DICTATION CARRIER APPLICATIONS CALL APPS CENTERS CRM CUSTOMER SUPPORT ARE TRANSLATION FUN DISTRIBUTED C O M M U N I C A T I O N S S C H E D U L I N G AND CONVERGENCE USEFULvenerdì 1 marzo 13
  4. 4. BUT...venerdì 1 marzo 13
  5. 5. THEY MUST BE STABLE!venerdì 1 marzo 13
  6. 6. THE VILLAINS - Application exceptions - Wrong call flow - Dropped calls - Integration errorsvenerdì 1 marzo 13
  7. 7. THE GOOD GUYS - Unit Testing - Functional Testing - Load Testingvenerdì 1 marzo 13
  8. 8. UNIT TESTINGvenerdì 1 marzo 13
  9. 9. Our goals for unit testing: - Confidence at the class level - Prevent regression errors - Promote proper code structure - Provide CI with something to help us withvenerdì 1 marzo 13
  10. 10. Unit testing Ahn apps - Call Controllers are an application’s core - RSpec recommended - Mock at the controller level - Support classes are just Ruby!venerdì 1 marzo 13
  11. 11. Adding RSpec - Generated apps are Gemfile: RSpec ready group :test do gem rspec - Your choice of mocking end framework - Just bundle installvenerdì 1 marzo 13
  12. 12. Spec File require spec_helper describe DemoController do let(:mock_call) { mock Call } subject do DemoController.new mock_call end let(:dtmf) { "1" } it "should answer, ask for a result, and say it" do subject.should_receive(:answer).once subject.should_receive(:ask).with("What is your favorite number?", :timeout => 10000, :limit => 1).once.and_return(dtmf) subject.should_receive(:say).with("Your favorite number seems to be #{dtmf}") subject.run end endvenerdì 1 marzo 13
  13. 13. Our controller class DemoController < Adhearsion::CallController def run answer result = ask "What is your favorite number?", :timeout => 10000, :limit => 1 say "Your favorite number seems to be #{result}" end endvenerdì 1 marzo 13
  14. 14. Passing? COOL!venerdì 1 marzo 13
  15. 15. FUNCTIONAL TESTINGvenerdì 1 marzo 13
  16. 16. Functional Testing 101 - Needs defining - Quite difficult to approach - Not solved by any single toolvenerdì 1 marzo 13
  17. 17. OK, WE ARE IN BAD SHAPE...venerdì 1 marzo 13
  18. 18. ...but here comes some help! SIPp ahn-loadbot PJSUAvenerdì 1 marzo 13
  19. 19. SIPp... ... is about as user friendly as the above lion.venerdì 1 marzo 13
  20. 20. SIPp (seriously) - http://sipp.sourceforge.net/ - Free and OSS Test tool and traffic generator - Can run XML scenarios defined by the user - Can play audio and interact - Requires good knowledge of SIPvenerdì 1 marzo 13
  21. 21. SIPp sample run sudo sipp -sn uac -s 1 -l 10 -r 5 -m 100 127.0.0.1 - Built-in scenario - Audio is PCAP, raw network capture of an RTP session - In custom scenarios, PCAP files are built with Wireshark/tcpdump - Ability to set call rate, concurrent calls, maximum number of calls, many other optionsvenerdì 1 marzo 13
  22. 22. SIPp options - -trace_err gives you an error log - -trace_stat outputs a CSV report - -rtp_echo echoes RTP back to the source - An XML scenario file can play PCAP, pause, and perform general call controlvenerdì 1 marzo 13
  23. 23. AHN-LOADBOTvenerdì 1 marzo 13
  24. 24. Friendly Neighborhood Robotvenerdì 1 marzo 13
  25. 25. The LoadBot - https://github.com/mojolingo/ahn-loadbot - Adhearsion 1 plugin - Drives calls though an Asterisk server - Can simulate a call, listen for audio, and record results - Metrics that can be used: duration of calls, ASR for presence of audiovenerdì 1 marzo 13
  26. 26. Loadbot scenario config: agi_server: 127.0.0.1 prefix: SIP/mycarrier plans: plan 1: number: 1231231234 answers: - 1 - Can be driven through DRb or directly through the Ahn1 APIvenerdì 1 marzo 13
  27. 27. PJSUAvenerdì 1 marzo 13
  28. 28. Someone has to answer too!venerdì 1 marzo 13
  29. 29. PJSUA at a glance - Can make single or multiple connection to SIP server - Can auto-answer, play audio, and record - Suitable for test support - Also is a handy tool for QoS - Does not run a “true” scenariovenerdì 1 marzo 13
  30. 30. Sample PJSUA command line pjsua --config-file options.conf options.conf: --null-audio --realm adhearsion.com --registrar sip.adhearsion.com --id sip:999@adhearsion.com --username 999 --password AdhearsionConf --nameserver 8.8.8.8 --auto-answer 200 --auto-loop --play-file monkeys.wavvenerdì 1 marzo 13
  31. 31. Functional takeaways - Set a specific goal for each scenario - Take advantage of CDR and APIs to do integration testing - Less automated than web functional testingvenerdì 1 marzo 13
  32. 32. LOAD TESTINGvenerdì 1 marzo 13
  33. 33. Is my system strong enough?venerdì 1 marzo 13
  34. 34. Load Testing is... - Running a high amount of concurrent calls - Decide what you are looking for - Tool of choice, SIPp or Loadbotvenerdì 1 marzo 13
  35. 35. Load testing metrics - Failed calls - Average call times getting too long - Exception tracking, not everything happens visiblyvenerdì 1 marzo 13
  36. 36. Thank you! http://mojolingo.com https://github.com/polysics Twitter: lucaprado XMPP and Email: lpradovera@mojolingo.com ...and please... NO MAKE KITTY SAD ...go rate my talk at http:/spkr8.com/17421venerdì 1 marzo 13

×