Testing Adhearsion Applications

36
TESTING ADHEARSION APPLICATIONS Luca Pradovera Voice Applica1on Developer Mojo Lingo LLC venerdì 1 marzo 13

description

Testing Adhearsion Applications presented by Luca Pradovera at AdhearsionConf 2012

Transcript of Testing Adhearsion Applications

Page 1: Testing Adhearsion Applications

TESTING ADHEARSION

APPLICATIONSLuca  Pradovera

Voice  Applica1on  DeveloperMojo  Lingo  LLC

venerdì 1 marzo 13

Page 2: Testing Adhearsion Applications

About me- Rubyist from Italy

- Voice Application Developer at Mojo Lingo

venerdì 1 marzo 13

Page 3: Testing Adhearsion Applications

ADHEARSION APPSAREFUNAND

USEFUL

DICTATION CARRIER A P P L I C A T I O N S C A L L

C E N T E R S C R M C U S T O M E R S U P P O R T TRANSLATION 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

CONVERGENCE

venerdì 1 marzo 13

Page 4: Testing Adhearsion Applications

BUT...

venerdì 1 marzo 13

Page 5: Testing Adhearsion Applications

THEY MUST BE STABLE!

venerdì 1 marzo 13

Page 6: Testing Adhearsion Applications

THE VILLAINS

- Application exceptions

- Wrong call flow

- Dropped calls

- Integration errors

venerdì 1 marzo 13

Page 7: Testing Adhearsion Applications

THE GOOD GUYS

- Unit Testing

- Functional Testing

- Load Testing

venerdì 1 marzo 13

Page 8: Testing Adhearsion Applications

UNIT TESTING

venerdì 1 marzo 13

Page 9: Testing Adhearsion Applications

Our goals for unit testing:

- Confidence at the class level

- Prevent regression errors

- Promote proper code structure

- Provide CI with something to help us with

venerdì 1 marzo 13

Page 10: Testing Adhearsion Applications

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

Page 11: Testing Adhearsion Applications

Adding RSpec

group :test do gem 'rspec'end

Gemfile:- Generated apps are

RSpec ready

- Your choice of mocking framework

- Just bundle install

venerdì 1 marzo 13

Page 12: Testing Adhearsion Applications

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 endend

venerdì 1 marzo 13

Page 13: Testing Adhearsion Applications

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}" endend

venerdì 1 marzo 13

Page 14: Testing Adhearsion Applications

Passing? COOL!

venerdì 1 marzo 13

Page 15: Testing Adhearsion Applications

FUNCTIONAL TESTING

venerdì 1 marzo 13

Page 16: Testing Adhearsion Applications

Functional Testing 101

- Needs defining

- Quite difficult to approach

- Not solved by any single tool

venerdì 1 marzo 13

Page 17: Testing Adhearsion Applications

OK, WE ARE IN BAD SHAPE...

venerdì 1 marzo 13

Page 18: Testing Adhearsion Applications

...but here comes some help!

SIPp

ahn-loadbot

PJSUA

venerdì 1 marzo 13

Page 19: Testing Adhearsion Applications

SIPp...

... is about as user friendly as the above lion.

venerdì 1 marzo 13

Page 20: Testing Adhearsion Applications

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 SIP

venerdì 1 marzo 13

Page 21: Testing Adhearsion Applications

SIPp sample run

- 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 options

sudo sipp -sn uac -s 1 -l 10 -r 5 -m 100 127.0.0.1

venerdì 1 marzo 13

Page 22: Testing Adhearsion Applications

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 control

venerdì 1 marzo 13

Page 23: Testing Adhearsion Applications

AHN-LOADBOT

venerdì 1 marzo 13

Page 24: Testing Adhearsion Applications

Friendly Neighborhood Robot

venerdì 1 marzo 13

Page 25: Testing Adhearsion Applications

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 audio

venerdì 1 marzo 13

Page 26: Testing Adhearsion Applications

Loadbot scenario

- Can be driven through DRb or directly through the Ahn1 API

config: agi_server: 127.0.0.1 prefix: SIP/mycarrier

plans: plan 1: number: 1231231234 answers: - 1

venerdì 1 marzo 13

Page 27: Testing Adhearsion Applications

PJSUA

venerdì 1 marzo 13

Page 28: Testing Adhearsion Applications

Someone has to answer too!

venerdì 1 marzo 13

Page 29: Testing Adhearsion Applications

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” scenario

venerdì 1 marzo 13

Page 30: Testing Adhearsion Applications

Sample PJSUA command linepjsua --config-file options.conf

options.conf:--null-audio--realm adhearsion.com--registrar sip.adhearsion.com--id sip:[email protected] 999--password AdhearsionConf--nameserver 8.8.8.8--auto-answer 200--auto-loop--play-file monkeys.wav

venerdì 1 marzo 13

Page 31: Testing Adhearsion Applications

Functional takeaways

- Set a specific goal for each scenario

- Take advantage of CDR and APIs to do integration testing

- Less automated than web functional testing

venerdì 1 marzo 13

Page 32: Testing Adhearsion Applications

LOAD TESTING

venerdì 1 marzo 13

Page 33: Testing Adhearsion Applications

Is my system strong enough?

venerdì 1 marzo 13

Page 34: Testing Adhearsion Applications

Load Testing is...

- Running a high amount of concurrent calls

- Decide what you are looking for

- Tool of choice, SIPp or Loadbot

venerdì 1 marzo 13

Page 35: Testing Adhearsion Applications

Load testing metrics

- Failed calls

- Average call times getting too long

- Exception tracking, not everything happens visibly

venerdì 1 marzo 13

Page 36: Testing Adhearsion Applications

Thank you!http://mojolingo.com

https://github.com/polysicsTwitter: lucaprado

XMPP and Email: [email protected]

...and please...

...go rate my talk athttp:/spkr8.com/17421

NO MAKE KITTY SAD

venerdì 1 marzo 13