SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
Designing Software For Testability
              A forgotten design pattern




Rohit Nayak
Talentica
Agenda

    Background and Motivation

    DFT in VLSI and hardware design

    Issues in Software Testing

    DFT for Software Development

    Automation and Testability

    Some Examples

    Cons, Review
The Anti-Pattern

      If it works,
its the developer,
  if not blame QA!
VLSI/PCB Testing Issues

    Mass produced

    Each piece needs to be validated

    Complexity
    −   Number of subsystems
    −   Amount of logic

    Access to internal logic

    Testing costs

    Cost of recall
Testability:
 “Effort required to
   test a product to
     ensure that it
performs its intended
       function”
DFT Principles

    Controllability

    Observability
    −   Test Point Insertion

    Built-In Self Test (BIST)

    Fault Modelling

    Fault Simulation

    Test Pattern Generation
Software Testing
“Testability is a design issue and needs to be
  addressed with the design of the rest of
  the system. Projects that defer testing to
  the later stages of a project will find their
  programmers unwilling to consider
  testability changes by the time testers
  actually roll onto the project and start
  making suggestions. Testability takes
  cooperation, appreciation and a team
  commitment to reliability.”
                                - Bret Pettichord
Cost Of Bugs

 Where Found       Requirements   Architecture   Coding   System Test   Production

Where Introduced


 Requirements          1x             3x         5-10x       10x        10x-100x
  Architecture                        1x          10x        15x         25-100x
    Coding                                         1x        10x          10-25x
Software Testability

    Suitability: clarity of specifications QA has

    Observability: we can only test what is visible

    Simplicity: easier design/UI makes testing easier

    Controllability: better the control, better the coverage
    and automation

    Stability: how often it changes

    Performance: how fast it works

    Diagnosability: writing effective bug reports!
Software DFT Patterns

    BIST                   
                               Controllability
    −   Automation suite       −   Decoupling
        w/ oracle              −   Bypassing
    −   Unit Tests             −   Mock/Stub
    −   Assertions             −   Set/Reset

    Fault Simulation       
                               Observability
    −   Mock/Stub              −   Logging
    −   Invalid params         −   Reporting
                               −   Test Interfaces
Good Automated Tests are

    Repeatable

    Easy to Write

    Easy to Understand

    Fast

    Way Easier with a Testable Software
When/How to Automate?

    Manager & Team are commited

    Testers/Dev either experienced or interested
    in learning to script

    Product release cycles managed well

    Functionality / UI changes under control

    Early/Incremental approaches work best

    Build integration, reporting

    Each bug results in a automated test
Automation As Coding

    Automation scripts and frameworks are CODE!

    Use tools and scripting languages

    Evaluate tools on real problems

    Follow development processes
    −   Spiral/Agile

    Use Source Control same as rest of code

    These will have bugs as well!
Test “oracle”

    Expected Result
    −   Generated once from previous run or
    −   Manually specified or
    −   Legacy system

    Time adjustment

    Results
    −   Database
    −   File
    −   Inline with code
Test Environment

    Multiple VMs

    Automated installs/images

    Automation tools

    Bug reporting tools
Unit Tests

    Each module has independent set

    Developer written/maintained

    setup, teardown

    xUnit, TestNG

    Runs on build

    Can run sub-set on install

    TDD
Diagnosability

    All environments: Test / Staging / Production

    Errors result in visual messages

    Errors are raised where they occur

    Errors can be localized

    Details are sufficient to fix issue

    Ability to send diag data to dev
Logging Module

    Log levels (VERBOSE, INFO, WARNING, ERROR, CRITICAL, TIME)

    Define CRITICAL/ERROR levels well and use them!

    These should result in urgent notifications

    Lower levels in Production

    Time, App, Component, ThreadId, Message
       8/2/2010 14:22pm: Notifier: Pop3: 8242: Sending welcome email to userid 334


    Delimited columns for import

    Rotation based on Time, Size
Built-in Self Test

    Inserting test code/interfaces

    Set/Reset to bring state to known value

    Reporting to get current state

    Assertions about values/state
      assert(order.billed==true)

    “oracle” based regression
Some Examples

    Web Application
    −   Software As A Service
    −   Browser Only UI
    −   Ajax / Dynamic HTML

    Banking (Client-Server)
    −   Installed Application
    −   Desktop Client
    −   Server API
Web Application

    HTML Page Title

    Id values for important divs/controls

    Hidden values (non-textual, graphs, tables)

    Measurable Ajax responses

    Tools: Selenium, Sahi, Watir, WebTest, curl

    Logging incl. browser/ip/session cookie

    Ability to simulate time zone, language
Web Application - 2

    Bypassing Captcha

    Mock TP APIs eg. Facebook, Google, OpenId

    SSL bypassing

    Transactions to be voided

    Multiple runs

    Always initialise controls
    −   Browser autofill
Desktop

    Unique identifiers to GUI controls

    Key Replay tools, SendKeys

    API test suites bypassing UI

    Client logs, ability to email

    Ability to run db queries in scripts
Desktop - 2

    Automation Friendly Third Party Controls
    −   Ability to select cell
    −   Copy-enable text fields
    −   Key shortcuts to Forms UI for control focus,
        clicking, navigation
    −   Access by value (tree/list controls)

    OCR for images/text consoles
Bypassing

    Credit card payment
    −   Test cards
    −   Mock object
    −   Dev auto-approval bypass code

    Order placement
    −   Dummy users, auto-fulfill
    −   Dummy vendors (email order)
    −   Admin screens move
Dates

    Never use system date directly

    Config override
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
       <appSettings>
        <add key=“SystemDate" value=“$now">
       </appSettings>
    </configuration>


    Nant: XMLPoke
    <xmlpoke file="App.config"
      xpath="/configuration/appSettings/add[@key = 'SystemDate']/@value"
      value="1-1-2009" />
Sending Emails

    Email subsystem should be a stub in dev

    Bypass SMTP: log to file …

    Email should be sent only to a whitelist

    Use Gmail Id & Atom API

    Use Unique Id/Timestamp to distinguish
Mocking / Stubbing

    Replace module during testing

    Different kinds:
    −   Sub-system (Email, Print)
    −   Webservice (Credit Card, Flight Booking)
    −   Hardware device (Biometric, CNC Machine)

    Return default values, implement simple/fixed
    logic
Mocks - 2

    Simulate Errors and Exceptions

    Provide more logging

    Jmock, Dependency Injection

    Con:
    −   Code level
    −   Needs to change with API
Anti-Testability Viewpoints

    Security compromise by testability interfaces,
    logging
    Remove or lock down in prod

    Extra coding time
    Much lower testing costs, better quality

    Privacy issues in logging
    Show only partial data

    Performance
    Almost never an issue in practice!
Review

    BIST                    
                                Controllability
    −   Automation suite        −   Decoupling
        w/ oracle               −   Bypassing
    −   Unit Tests              −   Mock/Stub
    −   Assertions              −   Set/Reset

    Fault Simulation        
                                Observability
    −   Mock/Stub               −   Logging
    −   Invalid params          −   Reporting

Más contenido relacionado

La actualidad más candente

William Truong_updated
William Truong_updatedWilliam Truong_updated
William Truong_updated
Bill Truong
 
Performance Test Slideshow Recent
Performance Test Slideshow RecentPerformance Test Slideshow Recent
Performance Test Slideshow Recent
Future Simmons
 
Pragmatic Java Test Automation
Pragmatic Java Test AutomationPragmatic Java Test Automation
Pragmatic Java Test Automation
Dmitry Buzdin
 
Web Application Testing
Web Application TestingWeb Application Testing
Web Application Testing
Richa Goel
 
Testing Presentation
Testing PresentationTesting Presentation
Testing Presentation
sureshpkumar
 
Testing Tool Evaluation Criteria
Testing Tool Evaluation CriteriaTesting Tool Evaluation Criteria
Testing Tool Evaluation Criteria
basma_iti_1984
 
Arun Prasad-R.DOCX
Arun Prasad-R.DOCXArun Prasad-R.DOCX
Arun Prasad-R.DOCX
Arun R
 

La actualidad más candente (20)

Automating Mobile Applications
Automating Mobile ApplicationsAutomating Mobile Applications
Automating Mobile Applications
 
Alliance Successful Selenium Automation
Alliance Successful Selenium AutomationAlliance Successful Selenium Automation
Alliance Successful Selenium Automation
 
Kscope presentation 2013
Kscope presentation 2013Kscope presentation 2013
Kscope presentation 2013
 
William Truong_updated
William Truong_updatedWilliam Truong_updated
William Truong_updated
 
A Test Automation Framework
A Test Automation FrameworkA Test Automation Framework
A Test Automation Framework
 
2012 student track - vs2010
2012   student track - vs20102012   student track - vs2010
2012 student track - vs2010
 
Mobile applications testing (challenges, tools & techniques)
Mobile applications testing (challenges, tools & techniques)Mobile applications testing (challenges, tools & techniques)
Mobile applications testing (challenges, tools & techniques)
 
Performance Test Slideshow Recent
Performance Test Slideshow RecentPerformance Test Slideshow Recent
Performance Test Slideshow Recent
 
Manual testing visonia
Manual testing   visoniaManual testing   visonia
Manual testing visonia
 
Pragmatic Java Test Automation
Pragmatic Java Test AutomationPragmatic Java Test Automation
Pragmatic Java Test Automation
 
Web Application Testing
Web Application TestingWeb Application Testing
Web Application Testing
 
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 
Testing Mobile Applications
Testing Mobile ApplicationsTesting Mobile Applications
Testing Mobile Applications
 
Types of test tools
Types of test toolsTypes of test tools
Types of test tools
 
Testing Presentation
Testing PresentationTesting Presentation
Testing Presentation
 
Testing Tool Evaluation Criteria
Testing Tool Evaluation CriteriaTesting Tool Evaluation Criteria
Testing Tool Evaluation Criteria
 
Data driven automation testing of web applications using selenium
Data driven automation testing of web applications using seleniumData driven automation testing of web applications using selenium
Data driven automation testing of web applications using selenium
 
Centralized test automation framework implementation
Centralized test automation framework implementationCentralized test automation framework implementation
Centralized test automation framework implementation
 
Arun Prasad-R.DOCX
Arun Prasad-R.DOCXArun Prasad-R.DOCX
Arun Prasad-R.DOCX
 

Similar a Designing for Testability - Rohit Nayak

Planning & building scalable test infrastructure
Planning  & building scalable test infrastructurePlanning  & building scalable test infrastructure
Planning & building scalable test infrastructure
Vijayan Reddy
 
Felix Ramos_Automation Programmer Analyst_QA
Felix Ramos_Automation Programmer Analyst_QAFelix Ramos_Automation Programmer Analyst_QA
Felix Ramos_Automation Programmer Analyst_QA
Felix Ramos
 
Gredy - test automation management and team collaboration
Gredy - test automation management and team collaborationGredy - test automation management and team collaboration
Gredy - test automation management and team collaboration
Gredy
 
Building Quality with Foundations of Mud
Building Quality with Foundations of MudBuilding Quality with Foundations of Mud
Building Quality with Foundations of Mud
seleniumconf
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
Quontra Solutions
 

Similar a Designing for Testability - Rohit Nayak (20)

Planning & building scalable test infrastructure
Planning  & building scalable test infrastructurePlanning  & building scalable test infrastructure
Planning & building scalable test infrastructure
 
Software Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails ApplicationsSoftware Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails Applications
 
Test automation lesson
Test automation lessonTest automation lesson
Test automation lesson
 
Innovative Test Automation Solution
Innovative Test Automation SolutionInnovative Test Automation Solution
Innovative Test Automation Solution
 
Felix Ramos_Automation Programmer Analyst_QA
Felix Ramos_Automation Programmer Analyst_QAFelix Ramos_Automation Programmer Analyst_QA
Felix Ramos_Automation Programmer Analyst_QA
 
Enhancing Quality and Test in Medical Device Design - Part 2.pdf
Enhancing Quality and Test in Medical Device Design - Part 2.pdfEnhancing Quality and Test in Medical Device Design - Part 2.pdf
Enhancing Quality and Test in Medical Device Design - Part 2.pdf
 
Next-gen Automation Framework
Next-gen Automation FrameworkNext-gen Automation Framework
Next-gen Automation Framework
 
04 test controlling and tracking
04   test controlling and tracking04   test controlling and tracking
04 test controlling and tracking
 
Agile Engineering Best Practices by Richard Cheng
Agile Engineering Best Practices by Richard ChengAgile Engineering Best Practices by Richard Cheng
Agile Engineering Best Practices by Richard Cheng
 
(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know
 
Good vs power automation frameworks
Good vs power automation frameworksGood vs power automation frameworks
Good vs power automation frameworks
 
Gredy - test automation management and team collaboration
Gredy - test automation management and team collaborationGredy - test automation management and team collaboration
Gredy - test automation management and team collaboration
 
Test Automation Frameworks Final
Test Automation Frameworks   FinalTest Automation Frameworks   Final
Test Automation Frameworks Final
 
Modernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-ArchitectModernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-Architect
 
Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015
 
Building Quality with Foundations of Mud
Building Quality with Foundations of MudBuilding Quality with Foundations of Mud
Building Quality with Foundations of Mud
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
 
Lightning Talks by Globant - Automation (This app runs by itself )
Lightning Talks by Globant -  Automation (This app runs by itself ) Lightning Talks by Globant -  Automation (This app runs by itself )
Lightning Talks by Globant - Automation (This app runs by itself )
 
Integration Testing as Validation and Monitoring
 Integration Testing as Validation and Monitoring Integration Testing as Validation and Monitoring
Integration Testing as Validation and Monitoring
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
 

Más de IndicThreads

Scrap Your MapReduce - Apache Spark
 Scrap Your MapReduce - Apache Spark Scrap Your MapReduce - Apache Spark
Scrap Your MapReduce - Apache Spark
IndicThreads
 
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
 Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
IndicThreads
 
Unraveling OpenStack Clouds
 Unraveling OpenStack Clouds Unraveling OpenStack Clouds
Unraveling OpenStack Clouds
IndicThreads
 

Más de IndicThreads (20)

Http2 is here! And why the web needs it
Http2 is here! And why the web needs itHttp2 is here! And why the web needs it
Http2 is here! And why the web needs it
 
Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
Understanding Bitcoin (Blockchain) and its Potential for Disruptive ApplicationsUnderstanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
 
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang way
 
Building Resilient Microservices
Building Resilient Microservices Building Resilient Microservices
Building Resilient Microservices
 
App using golang indicthreads
App using golang  indicthreadsApp using golang  indicthreads
App using golang indicthreads
 
Building on quicksand microservices indicthreads
Building on quicksand microservices  indicthreadsBuilding on quicksand microservices  indicthreads
Building on quicksand microservices indicthreads
 
How to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingHow to Think in RxJava Before Reacting
How to Think in RxJava Before Reacting
 
Iot secure connected devices indicthreads
Iot secure connected devices indicthreadsIot secure connected devices indicthreads
Iot secure connected devices indicthreads
 
Real world IoT for enterprises
Real world IoT for enterprisesReal world IoT for enterprises
Real world IoT for enterprises
 
IoT testing and quality assurance indicthreads
IoT testing and quality assurance indicthreadsIoT testing and quality assurance indicthreads
IoT testing and quality assurance indicthreads
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present Future
 
Harnessing the Power of Java 8 Streams
Harnessing the Power of Java 8 Streams Harnessing the Power of Java 8 Streams
Harnessing the Power of Java 8 Streams
 
Building & scaling a live streaming mobile platform - Gr8 road to fame
Building & scaling a live streaming mobile platform - Gr8 road to fameBuilding & scaling a live streaming mobile platform - Gr8 road to fame
Building & scaling a live streaming mobile platform - Gr8 road to fame
 
Internet of things architecture perspective - IndicThreads Conference
Internet of things architecture perspective - IndicThreads ConferenceInternet of things architecture perspective - IndicThreads Conference
Internet of things architecture perspective - IndicThreads Conference
 
Cars and Computers: Building a Java Carputer
 Cars and Computers: Building a Java Carputer Cars and Computers: Building a Java Carputer
Cars and Computers: Building a Java Carputer
 
Scrap Your MapReduce - Apache Spark
 Scrap Your MapReduce - Apache Spark Scrap Your MapReduce - Apache Spark
Scrap Your MapReduce - Apache Spark
 
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
 Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
 
Speed up your build pipeline for faster feedback
Speed up your build pipeline for faster feedbackSpeed up your build pipeline for faster feedback
Speed up your build pipeline for faster feedback
 
Unraveling OpenStack Clouds
 Unraveling OpenStack Clouds Unraveling OpenStack Clouds
Unraveling OpenStack Clouds
 
Digital Transformation of the Enterprise. What IT leaders need to know!
Digital Transformation of the Enterprise. What IT  leaders need to know!Digital Transformation of the Enterprise. What IT  leaders need to know!
Digital Transformation of the Enterprise. What IT leaders need to know!
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Designing for Testability - Rohit Nayak

  • 1. Designing Software For Testability A forgotten design pattern Rohit Nayak Talentica
  • 2. Agenda  Background and Motivation  DFT in VLSI and hardware design  Issues in Software Testing  DFT for Software Development  Automation and Testability  Some Examples  Cons, Review
  • 3. The Anti-Pattern If it works, its the developer, if not blame QA!
  • 4. VLSI/PCB Testing Issues  Mass produced  Each piece needs to be validated  Complexity − Number of subsystems − Amount of logic  Access to internal logic  Testing costs  Cost of recall
  • 5.
  • 6. Testability: “Effort required to test a product to ensure that it performs its intended function”
  • 7. DFT Principles  Controllability  Observability − Test Point Insertion  Built-In Self Test (BIST)  Fault Modelling  Fault Simulation  Test Pattern Generation
  • 8.
  • 9.
  • 10. Software Testing “Testability is a design issue and needs to be addressed with the design of the rest of the system. Projects that defer testing to the later stages of a project will find their programmers unwilling to consider testability changes by the time testers actually roll onto the project and start making suggestions. Testability takes cooperation, appreciation and a team commitment to reliability.” - Bret Pettichord
  • 11. Cost Of Bugs Where Found Requirements Architecture Coding System Test Production Where Introduced Requirements 1x 3x 5-10x 10x 10x-100x Architecture 1x 10x 15x 25-100x Coding 1x 10x 10-25x
  • 12.
  • 13. Software Testability  Suitability: clarity of specifications QA has  Observability: we can only test what is visible  Simplicity: easier design/UI makes testing easier  Controllability: better the control, better the coverage and automation  Stability: how often it changes  Performance: how fast it works  Diagnosability: writing effective bug reports!
  • 14. Software DFT Patterns  BIST  Controllability − Automation suite − Decoupling w/ oracle − Bypassing − Unit Tests − Mock/Stub − Assertions − Set/Reset  Fault Simulation  Observability − Mock/Stub − Logging − Invalid params − Reporting − Test Interfaces
  • 15. Good Automated Tests are  Repeatable  Easy to Write  Easy to Understand  Fast  Way Easier with a Testable Software
  • 16. When/How to Automate?  Manager & Team are commited  Testers/Dev either experienced or interested in learning to script  Product release cycles managed well  Functionality / UI changes under control  Early/Incremental approaches work best  Build integration, reporting  Each bug results in a automated test
  • 17. Automation As Coding  Automation scripts and frameworks are CODE!  Use tools and scripting languages  Evaluate tools on real problems  Follow development processes − Spiral/Agile  Use Source Control same as rest of code  These will have bugs as well!
  • 18. Test “oracle”  Expected Result − Generated once from previous run or − Manually specified or − Legacy system  Time adjustment  Results − Database − File − Inline with code
  • 19. Test Environment  Multiple VMs  Automated installs/images  Automation tools  Bug reporting tools
  • 20. Unit Tests  Each module has independent set  Developer written/maintained  setup, teardown  xUnit, TestNG  Runs on build  Can run sub-set on install  TDD
  • 21. Diagnosability  All environments: Test / Staging / Production  Errors result in visual messages  Errors are raised where they occur  Errors can be localized  Details are sufficient to fix issue  Ability to send diag data to dev
  • 22. Logging Module  Log levels (VERBOSE, INFO, WARNING, ERROR, CRITICAL, TIME)  Define CRITICAL/ERROR levels well and use them!  These should result in urgent notifications  Lower levels in Production  Time, App, Component, ThreadId, Message 8/2/2010 14:22pm: Notifier: Pop3: 8242: Sending welcome email to userid 334  Delimited columns for import  Rotation based on Time, Size
  • 23. Built-in Self Test  Inserting test code/interfaces  Set/Reset to bring state to known value  Reporting to get current state  Assertions about values/state assert(order.billed==true)  “oracle” based regression
  • 24. Some Examples  Web Application − Software As A Service − Browser Only UI − Ajax / Dynamic HTML  Banking (Client-Server) − Installed Application − Desktop Client − Server API
  • 25. Web Application  HTML Page Title  Id values for important divs/controls  Hidden values (non-textual, graphs, tables)  Measurable Ajax responses  Tools: Selenium, Sahi, Watir, WebTest, curl  Logging incl. browser/ip/session cookie  Ability to simulate time zone, language
  • 26. Web Application - 2  Bypassing Captcha  Mock TP APIs eg. Facebook, Google, OpenId  SSL bypassing  Transactions to be voided  Multiple runs  Always initialise controls − Browser autofill
  • 27. Desktop  Unique identifiers to GUI controls  Key Replay tools, SendKeys  API test suites bypassing UI  Client logs, ability to email  Ability to run db queries in scripts
  • 28. Desktop - 2  Automation Friendly Third Party Controls − Ability to select cell − Copy-enable text fields − Key shortcuts to Forms UI for control focus, clicking, navigation − Access by value (tree/list controls)  OCR for images/text consoles
  • 29. Bypassing  Credit card payment − Test cards − Mock object − Dev auto-approval bypass code  Order placement − Dummy users, auto-fulfill − Dummy vendors (email order) − Admin screens move
  • 30. Dates  Never use system date directly  Config override <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key=“SystemDate" value=“$now"> </appSettings> </configuration>  Nant: XMLPoke <xmlpoke file="App.config" xpath="/configuration/appSettings/add[@key = 'SystemDate']/@value" value="1-1-2009" />
  • 31. Sending Emails  Email subsystem should be a stub in dev  Bypass SMTP: log to file …  Email should be sent only to a whitelist  Use Gmail Id & Atom API  Use Unique Id/Timestamp to distinguish
  • 32. Mocking / Stubbing  Replace module during testing  Different kinds: − Sub-system (Email, Print) − Webservice (Credit Card, Flight Booking) − Hardware device (Biometric, CNC Machine)  Return default values, implement simple/fixed logic
  • 33. Mocks - 2  Simulate Errors and Exceptions  Provide more logging  Jmock, Dependency Injection  Con: − Code level − Needs to change with API
  • 34. Anti-Testability Viewpoints  Security compromise by testability interfaces, logging Remove or lock down in prod  Extra coding time Much lower testing costs, better quality  Privacy issues in logging Show only partial data  Performance Almost never an issue in practice!
  • 35. Review  BIST  Controllability − Automation suite − Decoupling w/ oracle − Bypassing − Unit Tests − Mock/Stub − Assertions − Set/Reset  Fault Simulation  Observability − Mock/Stub − Logging − Invalid params − Reporting