SlideShare uma empresa Scribd logo
1 de 74
Baixar para ler offline
Can You Hear Me Now?

       Tackling Testing Telephony
                                          Ben Klang
                                    bklang@mojolingo.com




Friday, August 10, 12
How Telephony Testing Is Different




Friday, August 10, 12
How Telephony Testing Is Different
        • Apps are long-running code




Friday, August 10, 12
How Telephony Testing Is Different
        • Apps are long-running code
        • Inputs may be more constrained (DTMF)




Friday, August 10, 12
How Telephony Testing Is Different
        • Apps are long-running code
        • Inputs may be more constrained (DTMF)
        • Or they may be less constrained (IM, Voice)




Friday, August 10, 12
How Telephony Testing Is Different
        • Apps are long-running code
        • Inputs may be more constrained (DTMF)
        • Or they may be less constrained (IM, Voice)
        • Lots of things are happening concurrently




Friday, August 10, 12
How Telephony Testing Is Different
        • Apps are long-running code
        • Inputs may be more constrained (DTMF)
        • Or they may be less constrained (IM, Voice)
        • Lots of things are happening concurrently
             • External call interactions (conf, barge)



Friday, August 10, 12
How Telephony Testing Is Different
        • Apps are long-running code
        • Inputs may be more constrained (DTMF)
        • Or they may be less constrained (IM, Voice)
        • Lots of things are happening concurrently
             • External call interactions (conf, barge)
             • XMPP Events

Friday, August 10, 12
How Telephony Testing Is Familiar




Friday, August 10, 12
How Telephony Testing Is Familiar
        • Same Tooling: rspec, mocha, cucumber,
          factory_girl, guard, rcov, rake




Friday, August 10, 12
How Telephony Testing Is Familiar
        • Same Tooling: rspec, mocha, cucumber,
          factory_girl, guard, rcov, rake
        • Still draw lines between M, V and C




Friday, August 10, 12
How Telephony Testing Is Familiar
        • Same Tooling: rspec, mocha, cucumber,
          factory_girl, guard, rcov, rake
        • Still draw lines between M, V and C
        • Good class design is important




Friday, August 10, 12
How Telephony Testing Is Familiar
        • Same Tooling: rspec, mocha, cucumber,
          factory_girl, guard, rcov, rake
        • Still draw lines between M, V and C
        • Good class design is important




Friday, August 10, 12
How Telephony Testing Is Familiar
        • Same Tooling: rspec, mocha, cucumber,
          factory_girl, guard, rcov, rake
        • Still draw lines between M, V and C
        • Good class design is important


        • It’s Just Ruby


Friday, August 10, 12
Philosophy: SRP




Friday, August 10, 12
Philosophy: SRP
        • Single Responsibility Principle




Friday, August 10, 12
Philosophy: SRP
        • Single Responsibility Principle
        • If you need to use “and” to describe the
          purpose of a class, you are probably
          breaking this rule




Friday, August 10, 12
Philosophy: SRP
        • Single Responsibility Principle
        • If you need to use “and” to describe the
          purpose of a class, you are probably
          breaking this rule
        • SRP is key to making classes testable




Friday, August 10, 12
SRP Example




Friday, August 10, 12
SRP Example
                        • Class purpose: “To
                          schedule calls and to
                          place them”




Friday, August 10, 12
SRP Example
                        • Class purpose: “To
                          schedule calls and to
                          place them”
                        • Testing requires mocking
                          methods within the same
                          class




Friday, August 10, 12
SRP Example
                        • Class purpose: “To
                          schedule calls and to
                          place them”
                        • Testing requires mocking
                          methods within the same
                          class
                        • Non-trivial work to swap
                          calling mechanism

Friday, August 10, 12
Philosophy: Tell, Don’t Ask




Friday, August 10, 12
Philosophy: Tell, Don’t Ask
        • Tell an object to do its work




Friday, August 10, 12
Philosophy: Tell, Don’t Ask
        • Tell an object to do its work
        • Don’t ask for its state then ask it to do
          something




Friday, August 10, 12
Philosophy: Tell, Don’t Ask
        • Tell an object to do its work
        • Don’t ask for its state then ask it to do
          something
        • Works Hand-in-Hand with SRP




Friday, August 10, 12
Philosophy: Tell, Don’t Ask
        • Tell an object to do its work
        • Don’t ask for its state then ask it to do
          something
        • Works Hand-in-Hand with SRP




Friday, August 10, 12
Philosophy: Tell, Don’t Ask
        • Tell an object to do its work
        • Don’t ask for its state then ask it to do
          something
        • Works Hand-in-Hand with SRP




Friday, August 10, 12
Philosophy: Prefer/Share Immutable




Friday, August 10, 12
Philosophy: Prefer/Share Immutable
        • Methods should only use passed-in data




Friday, August 10, 12
Philosophy: Prefer/Share Immutable
        • Methods should only use passed-in data
        • Avoid instance vars or other shared state




Friday, August 10, 12
Philosophy: Prefer/Share Immutable
        • Methods should only use passed-in data
        • Avoid instance vars or other shared state
        • Especially helpful with concurrent code




Friday, August 10, 12
Philosophy: Prefer/Share Immutable
        • Methods should only use passed-in data
        • Avoid instance vars or other shared state
        • Especially helpful with concurrent code
        • ... but makes testing in general easier




Friday, August 10, 12
Prefer/Share Immutable Example




Friday, August 10, 12
Prefer/Share Immutable Example




Friday, August 10, 12
Prefer/Share Immutable Example




Friday, August 10, 12
Prefer/Share Immutable Example




Friday, August 10, 12
Levels of Testing




Friday, August 10, 12
Levels of Testing


                         Integration




Friday, August 10, 12
Levels of Testing


                         Integration
                             Functional




Friday, August 10, 12
Levels of Testing


                         Integration
                             Functional
                                Unit




Friday, August 10, 12
Levels of Testing




Friday, August 10, 12
Levels of Testing
        • Integration Testing




Friday, August 10, 12
Levels of Testing
        • Integration Testing
             • End-to-End




Friday, August 10, 12
Levels of Testing
        • Integration Testing
             • End-to-End
             • Provide predefined inputs




Friday, August 10, 12
Levels of Testing
        • Integration Testing
             • End-to-End
             • Provide predefined inputs
             • Verify outputs




Friday, August 10, 12
Levels of Testing
        • Integration Testing
             • End-to-End
             • Provide predefined inputs
             • Verify outputs
             • Mock as little as possible



Friday, August 10, 12
Integration Testing Tools for Telephony




Friday, August 10, 12
Integration Testing Tools for Telephony
             • sipp:
               sipp.sourceforge.net




Friday, August 10, 12
Integration Testing Tools for Telephony
             • sipp:
               sipp.sourceforge.net
             • Loadbot:
               github.com/mojolingo/ahn-loadbot




Friday, August 10, 12
Integration Testing Tools for Telephony
             • sipp:
               sipp.sourceforge.net
             • Loadbot:
               github.com/mojolingo/ahn-loadbot
             • Cucumber-VoIP:
               github.com/benlangfeld/cucumber-voip




Friday, August 10, 12
Functional Testing




Friday, August 10, 12
Functional Testing
        • Test just one unit in isolation




Friday, August 10, 12
Functional Testing
        • Test just one unit in isolation
        • Typical unit is a single class




Friday, August 10, 12
Functional Testing
        • Test just one unit in isolation
        • Typical unit is a single class
        • Test function of class
          but do not make
          assertions about
          internal state



Friday, August 10, 12
Unit Testing




Friday, August 10, 12
Unit Testing
        • Most common form of testing




Friday, August 10, 12
Unit Testing
        • Most common form of testing
        • Test that a given unit (typically: method)
          behaves the way you expect




Friday, August 10, 12
Unit Testing
        • Most common form of testing
        • Test that a given unit (typically: method)
          behaves the way you expect
        • Make sure to test:




Friday, August 10, 12
Unit Testing
        • Most common form of testing
        • Test that a given unit (typically: method)
          behaves the way you expect
        • Make sure to test:
             • Valid inputs




Friday, August 10, 12
Unit Testing
        • Most common form of testing
        • Test that a given unit (typically: method)
          behaves the way you expect
        • Make sure to test:
             • Valid inputs
             • Invalid inputs



Friday, August 10, 12
Unit Testing
        • Most common form of testing
        • Test that a given unit (typically: method)
          behaves the way you expect
        • Make sure to test:
             • Valid inputs
             • Invalid inputs
             • Error Conditions

Friday, August 10, 12
Unit Testing Example




Friday, August 10, 12
Unit Testing Example




Friday, August 10, 12
Testing Concurrency




Friday, August 10, 12
Testing Concurrency
        • Design with a concurrency model or library




Friday, August 10, 12
Testing Concurrency
        • Design with a concurrency model or library
             • Celluloid, EventMachine




Friday, August 10, 12
Testing Concurrency
        • Design with a concurrency model or library
             • Celluloid, EventMachine
        • Use State Machines to guarantee sequence




Friday, August 10, 12
Testing Concurrency
        • Design with a concurrency model or library
             • Celluloid, EventMachine
        • Use State Machines to guarantee sequence
        • Mock non-blocking dependent operations
          with blocking mocks




Friday, August 10, 12
Testing Concurrency
        • Design with a concurrency model or library
             • Celluloid, EventMachine
        • Use State Machines to guarantee sequence
        • Mock non-blocking dependent operations
          with blocking mocks
        • Always provide a timeout


Friday, August 10, 12
Testing Concurrency




                    https://github.com/benlangfeld/countdownlatch


Friday, August 10, 12
Testing Concurrency




                    https://github.com/benlangfeld/countdownlatch


Friday, August 10, 12
http://adhearsion.com/conference/2012




Friday, August 10, 12
Can You Hear Me Now?

       Tackling Testing Telephony                 Ben Klang
                                            bklang@mojolingo.com
       spkr8.com/t/12971                    @bklang Github/Twitter
        Thanks to Ben Langfeld for his
        assistance with this presentation
        @benlangfeld




Friday, August 10, 12

Mais conteúdo relacionado

Semelhante a Can You Hear Me Now? Tackling Telephony Testing

Keeping your users happy with testable apps - Greg Shackles
Keeping your users happy with testable apps - Greg ShacklesKeeping your users happy with testable apps - Greg Shackles
Keeping your users happy with testable apps - Greg ShacklesXamarin
 
Are Your Tests Really Helping You?
Are Your Tests Really Helping You?Are Your Tests Really Helping You?
Are Your Tests Really Helping You?LB Denker
 
Kostentreiber bei der iOS Entwicklung
Kostentreiber bei der iOS EntwicklungKostentreiber bei der iOS Entwicklung
Kostentreiber bei der iOS EntwicklungReto Zenger
 
Kostentreiber bei der iOS-Entwicklung
Kostentreiber bei der iOS-EntwicklungKostentreiber bei der iOS-Entwicklung
Kostentreiber bei der iOS-Entwicklungxrb
 
Words, Pictures & Pixels: Put Your Best Foot Forward Online
Words, Pictures & Pixels: Put Your Best Foot Forward OnlineWords, Pictures & Pixels: Put Your Best Foot Forward Online
Words, Pictures & Pixels: Put Your Best Foot Forward Onlinebethgsanders
 
How To Build an Online Community
How To Build an Online CommunityHow To Build an Online Community
How To Build an Online CommunityDigital Wax Works
 
Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"
Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"
Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"SCRUMguides
 

Semelhante a Can You Hear Me Now? Tackling Telephony Testing (10)

Keeping your users happy with testable apps - Greg Shackles
Keeping your users happy with testable apps - Greg ShacklesKeeping your users happy with testable apps - Greg Shackles
Keeping your users happy with testable apps - Greg Shackles
 
SPRINT3R-SWPSDLC2556-CLOSING
SPRINT3R-SWPSDLC2556-CLOSINGSPRINT3R-SWPSDLC2556-CLOSING
SPRINT3R-SWPSDLC2556-CLOSING
 
Week 6 october 8
Week 6 october 8Week 6 october 8
Week 6 october 8
 
When Tdd Goes Awry
When Tdd Goes AwryWhen Tdd Goes Awry
When Tdd Goes Awry
 
Are Your Tests Really Helping You?
Are Your Tests Really Helping You?Are Your Tests Really Helping You?
Are Your Tests Really Helping You?
 
Kostentreiber bei der iOS Entwicklung
Kostentreiber bei der iOS EntwicklungKostentreiber bei der iOS Entwicklung
Kostentreiber bei der iOS Entwicklung
 
Kostentreiber bei der iOS-Entwicklung
Kostentreiber bei der iOS-EntwicklungKostentreiber bei der iOS-Entwicklung
Kostentreiber bei der iOS-Entwicklung
 
Words, Pictures & Pixels: Put Your Best Foot Forward Online
Words, Pictures & Pixels: Put Your Best Foot Forward OnlineWords, Pictures & Pixels: Put Your Best Foot Forward Online
Words, Pictures & Pixels: Put Your Best Foot Forward Online
 
How To Build an Online Community
How To Build an Online CommunityHow To Build an Online Community
How To Build an Online Community
 
Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"
Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"
Agileee 2013: Andrii Dzynia "How To Manage Testing in Agile World"
 

Mais de Adhearsion Foundation

Mais de Adhearsion Foundation (10)

Ruby Conf 2011
Ruby Conf 2011Ruby Conf 2011
Ruby Conf 2011
 
Ahn Conf 2011 - Day 2 Keynote
Ahn Conf 2011 - Day 2 KeynoteAhn Conf 2011 - Day 2 Keynote
Ahn Conf 2011 - Day 2 Keynote
 
Adhearsion Astricon October 2010
Adhearsion Astricon October 2010Adhearsion Astricon October 2010
Adhearsion Astricon October 2010
 
Ruby Kaigi July 2009 Tokyo (Japanese)
Ruby Kaigi July 2009 Tokyo (Japanese)Ruby Kaigi July 2009 Tokyo (Japanese)
Ruby Kaigi July 2009 Tokyo (Japanese)
 
N2Y4 Mobile Challenge May 2009 San Jose
N2Y4 Mobile Challenge May 2009   San JoseN2Y4 Mobile Challenge May 2009   San Jose
N2Y4 Mobile Challenge May 2009 San Jose
 
Eu Ru Ko Tutorial May 2009 Barcelona
Eu Ru Ko Tutorial May 2009   BarcelonaEu Ru Ko Tutorial May 2009   Barcelona
Eu Ru Ko Tutorial May 2009 Barcelona
 
Amoocon Tutorial May 2009 Germany
Amoocon Tutorial May 2009   GermanyAmoocon Tutorial May 2009   Germany
Amoocon Tutorial May 2009 Germany
 
Amoocon May 2009 Germany
Amoocon May 2009   GermanyAmoocon May 2009   Germany
Amoocon May 2009 Germany
 
Adhearsion @ eComm 2009 Final
Adhearsion @ eComm 2009   FinalAdhearsion @ eComm 2009   Final
Adhearsion @ eComm 2009 Final
 
Adhearsion Overview February 2009
Adhearsion Overview February 2009Adhearsion Overview February 2009
Adhearsion Overview February 2009
 

Último

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Can You Hear Me Now? Tackling Telephony Testing

  • 1. Can You Hear Me Now? Tackling Testing Telephony Ben Klang bklang@mojolingo.com Friday, August 10, 12
  • 2. How Telephony Testing Is Different Friday, August 10, 12
  • 3. How Telephony Testing Is Different • Apps are long-running code Friday, August 10, 12
  • 4. How Telephony Testing Is Different • Apps are long-running code • Inputs may be more constrained (DTMF) Friday, August 10, 12
  • 5. How Telephony Testing Is Different • Apps are long-running code • Inputs may be more constrained (DTMF) • Or they may be less constrained (IM, Voice) Friday, August 10, 12
  • 6. How Telephony Testing Is Different • Apps are long-running code • Inputs may be more constrained (DTMF) • Or they may be less constrained (IM, Voice) • Lots of things are happening concurrently Friday, August 10, 12
  • 7. How Telephony Testing Is Different • Apps are long-running code • Inputs may be more constrained (DTMF) • Or they may be less constrained (IM, Voice) • Lots of things are happening concurrently • External call interactions (conf, barge) Friday, August 10, 12
  • 8. How Telephony Testing Is Different • Apps are long-running code • Inputs may be more constrained (DTMF) • Or they may be less constrained (IM, Voice) • Lots of things are happening concurrently • External call interactions (conf, barge) • XMPP Events Friday, August 10, 12
  • 9. How Telephony Testing Is Familiar Friday, August 10, 12
  • 10. How Telephony Testing Is Familiar • Same Tooling: rspec, mocha, cucumber, factory_girl, guard, rcov, rake Friday, August 10, 12
  • 11. How Telephony Testing Is Familiar • Same Tooling: rspec, mocha, cucumber, factory_girl, guard, rcov, rake • Still draw lines between M, V and C Friday, August 10, 12
  • 12. How Telephony Testing Is Familiar • Same Tooling: rspec, mocha, cucumber, factory_girl, guard, rcov, rake • Still draw lines between M, V and C • Good class design is important Friday, August 10, 12
  • 13. How Telephony Testing Is Familiar • Same Tooling: rspec, mocha, cucumber, factory_girl, guard, rcov, rake • Still draw lines between M, V and C • Good class design is important Friday, August 10, 12
  • 14. How Telephony Testing Is Familiar • Same Tooling: rspec, mocha, cucumber, factory_girl, guard, rcov, rake • Still draw lines between M, V and C • Good class design is important • It’s Just Ruby Friday, August 10, 12
  • 16. Philosophy: SRP • Single Responsibility Principle Friday, August 10, 12
  • 17. Philosophy: SRP • Single Responsibility Principle • If you need to use “and” to describe the purpose of a class, you are probably breaking this rule Friday, August 10, 12
  • 18. Philosophy: SRP • Single Responsibility Principle • If you need to use “and” to describe the purpose of a class, you are probably breaking this rule • SRP is key to making classes testable Friday, August 10, 12
  • 20. SRP Example • Class purpose: “To schedule calls and to place them” Friday, August 10, 12
  • 21. SRP Example • Class purpose: “To schedule calls and to place them” • Testing requires mocking methods within the same class Friday, August 10, 12
  • 22. SRP Example • Class purpose: “To schedule calls and to place them” • Testing requires mocking methods within the same class • Non-trivial work to swap calling mechanism Friday, August 10, 12
  • 23. Philosophy: Tell, Don’t Ask Friday, August 10, 12
  • 24. Philosophy: Tell, Don’t Ask • Tell an object to do its work Friday, August 10, 12
  • 25. Philosophy: Tell, Don’t Ask • Tell an object to do its work • Don’t ask for its state then ask it to do something Friday, August 10, 12
  • 26. Philosophy: Tell, Don’t Ask • Tell an object to do its work • Don’t ask for its state then ask it to do something • Works Hand-in-Hand with SRP Friday, August 10, 12
  • 27. Philosophy: Tell, Don’t Ask • Tell an object to do its work • Don’t ask for its state then ask it to do something • Works Hand-in-Hand with SRP Friday, August 10, 12
  • 28. Philosophy: Tell, Don’t Ask • Tell an object to do its work • Don’t ask for its state then ask it to do something • Works Hand-in-Hand with SRP Friday, August 10, 12
  • 30. Philosophy: Prefer/Share Immutable • Methods should only use passed-in data Friday, August 10, 12
  • 31. Philosophy: Prefer/Share Immutable • Methods should only use passed-in data • Avoid instance vars or other shared state Friday, August 10, 12
  • 32. Philosophy: Prefer/Share Immutable • Methods should only use passed-in data • Avoid instance vars or other shared state • Especially helpful with concurrent code Friday, August 10, 12
  • 33. Philosophy: Prefer/Share Immutable • Methods should only use passed-in data • Avoid instance vars or other shared state • Especially helpful with concurrent code • ... but makes testing in general easier Friday, August 10, 12
  • 38. Levels of Testing Friday, August 10, 12
  • 39. Levels of Testing Integration Friday, August 10, 12
  • 40. Levels of Testing Integration Functional Friday, August 10, 12
  • 41. Levels of Testing Integration Functional Unit Friday, August 10, 12
  • 42. Levels of Testing Friday, August 10, 12
  • 43. Levels of Testing • Integration Testing Friday, August 10, 12
  • 44. Levels of Testing • Integration Testing • End-to-End Friday, August 10, 12
  • 45. Levels of Testing • Integration Testing • End-to-End • Provide predefined inputs Friday, August 10, 12
  • 46. Levels of Testing • Integration Testing • End-to-End • Provide predefined inputs • Verify outputs Friday, August 10, 12
  • 47. Levels of Testing • Integration Testing • End-to-End • Provide predefined inputs • Verify outputs • Mock as little as possible Friday, August 10, 12
  • 48. Integration Testing Tools for Telephony Friday, August 10, 12
  • 49. Integration Testing Tools for Telephony • sipp: sipp.sourceforge.net Friday, August 10, 12
  • 50. Integration Testing Tools for Telephony • sipp: sipp.sourceforge.net • Loadbot: github.com/mojolingo/ahn-loadbot Friday, August 10, 12
  • 51. Integration Testing Tools for Telephony • sipp: sipp.sourceforge.net • Loadbot: github.com/mojolingo/ahn-loadbot • Cucumber-VoIP: github.com/benlangfeld/cucumber-voip Friday, August 10, 12
  • 53. Functional Testing • Test just one unit in isolation Friday, August 10, 12
  • 54. Functional Testing • Test just one unit in isolation • Typical unit is a single class Friday, August 10, 12
  • 55. Functional Testing • Test just one unit in isolation • Typical unit is a single class • Test function of class but do not make assertions about internal state Friday, August 10, 12
  • 57. Unit Testing • Most common form of testing Friday, August 10, 12
  • 58. Unit Testing • Most common form of testing • Test that a given unit (typically: method) behaves the way you expect Friday, August 10, 12
  • 59. Unit Testing • Most common form of testing • Test that a given unit (typically: method) behaves the way you expect • Make sure to test: Friday, August 10, 12
  • 60. Unit Testing • Most common form of testing • Test that a given unit (typically: method) behaves the way you expect • Make sure to test: • Valid inputs Friday, August 10, 12
  • 61. Unit Testing • Most common form of testing • Test that a given unit (typically: method) behaves the way you expect • Make sure to test: • Valid inputs • Invalid inputs Friday, August 10, 12
  • 62. Unit Testing • Most common form of testing • Test that a given unit (typically: method) behaves the way you expect • Make sure to test: • Valid inputs • Invalid inputs • Error Conditions Friday, August 10, 12
  • 66. Testing Concurrency • Design with a concurrency model or library Friday, August 10, 12
  • 67. Testing Concurrency • Design with a concurrency model or library • Celluloid, EventMachine Friday, August 10, 12
  • 68. Testing Concurrency • Design with a concurrency model or library • Celluloid, EventMachine • Use State Machines to guarantee sequence Friday, August 10, 12
  • 69. Testing Concurrency • Design with a concurrency model or library • Celluloid, EventMachine • Use State Machines to guarantee sequence • Mock non-blocking dependent operations with blocking mocks Friday, August 10, 12
  • 70. Testing Concurrency • Design with a concurrency model or library • Celluloid, EventMachine • Use State Machines to guarantee sequence • Mock non-blocking dependent operations with blocking mocks • Always provide a timeout Friday, August 10, 12
  • 71. Testing Concurrency https://github.com/benlangfeld/countdownlatch Friday, August 10, 12
  • 72. Testing Concurrency https://github.com/benlangfeld/countdownlatch Friday, August 10, 12
  • 74. Can You Hear Me Now? Tackling Testing Telephony Ben Klang bklang@mojolingo.com spkr8.com/t/12971 @bklang Github/Twitter Thanks to Ben Langfeld for his assistance with this presentation @benlangfeld Friday, August 10, 12