SlideShare une entreprise Scribd logo
1  sur  74
Télécharger pour lire hors ligne
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

Contenu connexe

Similaire à 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
 

Similaire à 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"
 

Plus de Adhearsion Foundation

Plus 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
 

Dernier

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

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