Lecture 17: Testing Strategies" Developer Testing"

Similar documents
Software testing. Objectives

The Dangers of Use Cases Employed as Test Cases

Software Engineering. Software Testing. Based on Software Engineering, 7 th Edition by Ian Sommerville

4. Test Design Techniques

Sofware Requirements Engineeing

Exploratory Testing Dynamics

Chapter 8 Software Testing

Legal Notes. Regarding Trademarks. Model supported by the KX printer driver KYOCERA MITA Corporation

Exploratory Testing in an Agile Context

WAMLocal. Wireless Asset Monitoring - Local Food Safety Software. Software Installation and User Guide BA/WAM-L-F

Introduction to Computers and Programming. Testing

The Big Picture. Cache Memory CSE Memory Hierarchy (1/3) Disk

Presentation: 1.1 Introduction to Software Testing

CIS 544 Advanced Software Design and Development. Project Management System. Oreoluwa Alebiosu

Rational Quality Manager. Quick Start Tutorial

Lecture 17: Requirements Specifications

Symantec Backup Exec 12.5 for Windows Servers. Quick Installation Guide

Migration Strategies and Tools for the HP Print Server Appliance

Exploratory Testing Dynamics

Big Data-Challenges and Opportunities

Web Load Stress Testing

Test Management and Techniques

DOCUMENTING USE CASES

Part 3: Accessing Local drives and printers from the Terminal Server

(Refer Slide Time: 01:52)

HOW TO SILENTLY INSTALL CLOUD LINK REMOTELY WITHOUT SUPERVISION

Spectrum Technology Platform. Version 9.0. Administration Guide

Formal Software Testing. Terri Grenda, CSTE IV&V Testing Solutions, LLC

hp embedded web server for hp LaserJet printers

FSW QA Testing Levels Definitions

ISTQB Certified Tester. Foundation Level. Sample Exam 1

Rev 7 06-OCT Site Manager Installation Guide

DataLogger Kepware, Inc.

STUDY AND ANALYSIS OF AUTOMATION TESTING TECHNIQUES

Guideline for stresstest Page 1 of 6. Stress test

CSC 2405: Computer Systems II

Testing Automation for Distributed Applications By Isabel Drost-Fromm, Software Engineer, Elastic

Peach Fuzzer Platform

Test Case Design Techniques

How To Install The Snow Active Directory Discovery Service On Windows (Windows) (Windows 7) (Powerbook) (For Windows) (Amd64) (Apple) (Macintosh) (Netbook) And (Windows

Key Points. Quality Assurance and Testing. Defect Process. Developer Practice

How To Understand The Error Codes On A Crystal Reports Print Engine

Application Compatibility Best Practices for Remote Desktop Services

Volume I, Section 4 Table of Contents

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland

APS Package Certification Guide

Certification Authorities Software Team (CAST) Position Paper CAST-10

Deploying System Center 2012 R2 Configuration Manager

SPI Backup via Remote Terminal


Pearl Echo Installation Checklist

Product Guide. McAfee Security-as-a-Service Partner SecurityDashboard 5.2.0

JOURNAL OF OBJECT TECHNOLOGY

SECTION 4 TESTING & QUALITY CONTROL

Browser Client 2.0 Admin Guide

Automation License Manager

Symantec Backup Exec TM 11d for Windows Servers. Quick Installation Guide

Decision Support System Software Asset Management (SAM)

IEI emerge and Milestone Systems Network Video Recorder. Setup and Integration Guide. Milestone Version 6.5 and emerge Version 3.

System Center Configuration Manager 2007

SPECIFICATION BY EXAMPLE. Gojko Adzic. How successful teams deliver the right software. MANNING Shelter Island

Introduction to Automated Testing

Meeting DO-178B Software Verification Guidelines with Coverity Integrity Center

Test Data Management Best Practice

GE Fanuc Automation CIMPLICITY

Configuring a Custom Load Evaluator Use the XenApp1 virtual machine, logged on as the XenApp\administrator user for this task.

GWAVA 5. Migration Guide for Netware GWAVA 4 to Linux GWAVA 5

Standard Glossary of Terms Used in Software Testing. Version 3.01

Basic Testing Concepts and Terminology

Horizon Debt Collect. User s and Administrator s Guide

IEI emerge and On-Net Surveillance Systems (OnSSI) Network Video Recorder Setup and Integration Guide

Software Testing. Knowledge Base. Rajat Kumar Bal. Introduction

Best Practices for Verification, Validation, and Test in Model- Based Design

Colorado. Provider POS Device User Manual Where to call for POS device troubleshooting: Version: 2.0

Oracle Solaris Studio Code Analyzer

Automation can dramatically increase product quality, leading to lower field service, product support and

Symantec Backup Exec 2010 R2. Quick Installation Guide

Coverity White Paper. Effective Management of Static Analysis Vulnerabilities and Defects

Chapter 7: Software Development Stages Test your knowledge - answers

Automating Security Testing. Mark Fallon Senior Release Manager Oracle

Evaluator s Guide. PC-Duo Enterprise HelpDesk v5.0. Copyright 2006 Vector Networks Ltd and MetaQuest Software Inc. All rights reserved.

There are numerous ways to access monitors:

Database Administration

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur

BillQuick Agent 2010 Getting Started Guide

Testing Introduction. IEEE Definitions

13 Managing Devices. Your computer is an assembly of many components from different manufacturers. LESSON OBJECTIVES

Whitepaper: performance of SqlBulkCopy

Verifone Terminal FAQs (version D413):

HP LaserJet MFP Analog Fax Accessory 300 Send Fax Driver Guide

Virtual Data Centre. User Guide

ODBC Client Driver Help Kepware, Inc.

Quick Start Guide NVR DS-7104NI-SL/W NVR. First Choice For Security Professionals

Transcription:

Lecture 17: Testing Strategies Structural Coverage Strategies (White box testing): Statement Coverage Branch Coverage Condition Coverage Data Path Coverage Function Coverage Strategies (Black box testing): Use Cases as Test Cases Testing with good and bad data Stress Testing Quick Test Interference Testing A radical alternative: Exploratory Testing 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1 Developer Testing Write the test cases first minimize the time to defect discovery forces you to think carefully about the requirements first exposes requirements problems early supports a daily smoke test But: Limitations of Developer Testing Emphasis on clean tests (vs. dirty tests) immature organisations have 1 dirty : 5 clean mature organisations have 5 dirty : 1 clean Developers overestimate test coverage Developers tend to focus on statement coverage rather than Summary: Test-case first strategy is extremely valuable Test-case first strategy is not enough 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2 1

Structured Basis Testing The minimal set of tests to cover every branch How many tests? start with 1 for the straight path add 1 for each of these keywords: if, while, repeat, for, and, or add 1 for each branch of a case statement Example int midval (int x, y, z) { /* effects: returns median value of the three inputs */ if (x > y) { if (x > z) return x else return z else { if (y > z) return y else return z Source: Adapted from McConnell 2004, p506-508 Count 1 + 3 if s = 4 test cases Now choose the cases to exercise the 4 paths: e.g. x=3, y=2, z=1 x=3, y=2, z=4 x=2, y=3, z=2 x=2, y=3, z=4 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3 Complex Conditions Source: Adapted from Christopher Ackermann s slides Branch Coverage:! If ((a) & (b) (c)) then true false Condition Coverage:! If ((a) & (b) (c)) then true false true false true false But can you show that! each part has an independent! effect on the outcome?! If ((a) & (b) (c)) then true false true false 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4 2

MC/DC Coverage Source: Adapted from Christopher Ackermann s slides Show that each basic condition can affect the result If ((a) & (b) (c)) then Number ABC Result A B C 1! TTT! T! 5! 2! TTF! T! 6! 4! 3! TFT! T! 7! 4! 4! TFF! F! 2! 3! 5! FTT! F! 1! 6! FTF! F! 2! 7! FFT! F! 3! 8! FFF! F! (1) Compute truth table for the condition (2) In each row, identify any case where flipping one variable changes the result. (3) Choose a minimal set: Eg. {2, 3, 4, 6 or {2, 3, 4, 7 (4) Write a test case for each element of the set 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5 MC/DC versus Branch Coverage Compiler can translate conditions in the object code: Test sets for Condition/Decision coverage: {1, 8 or {2, 7 or {3, 6 Covers all paths in the source code, but not all paths in the object code Test sets for Modified Condition/Decision Coverage {2, 3, 4, 6 or {2, 3, 4, 7 Covers all paths in the object code Source: Adapted from Christopher Ackermann s slides 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6 3

About MC/DC Advantages: Linear growth in the number of conditions Ensures coverage of the object code Discovers dead code (operands that have no effect) Mandated by the US Federal Aviation Administration In avionics, complex boolean expressions are common Has been shown to uncover important errors not detected by other test approaches Itʼs expensive E.g. Boeing 777 (first fly-by-wire commercial aircraft) approx 4 million lines of code, 2.5 million newly developed approx 70% of this is Ada (the rest is C or assembler) Total cost of aircraft development: $5.5 billion Cost of testing to MC/DC criteria: approx. $1.5 billion 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7 Dataflow testing Source: Adapted from McConnell 2004, p506-508 Things that happen to data: Defined - data is initialized but not yet used Used - data is used in a computation Killed - space is released Entered - working copy created on entry to a method Exited - working copy removed on exit from a method Normal life: Defined once, Used a number of times, then Killed Potential Defects: D-D: variable is defined twice D-Ex, D-K: variable defined but not used En-K: destroying a local variable that wasnʼt defined? En-U: for local variable, used before itʼs initialized K-K: unnecessary killing - can hang the machine? K-U: using data after it has been destroyed U-D: redefining a variable after is has been used 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8 4

Testing all D-U paths The minimal set of tests to cover every D-U path How many tests? 1 test for each path from each definition to each use of the variable Example Source: Adapted from McConnell 2004, p506-508 D:! D:! U:! U:! if (Cond1) { x = a; else { x = b; if (Cond2) { y = x + 1 else { y = x - 1; Structured Basis Testing: 2 test cases is sufficient Case 1: Cond1=true, Cond2=true Case 2: Cond1=false, Cond2=false All DU testing: Need 4 test cases 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9 Boundary Analysis Every boundary needs 3 tests: Example: Boundary Checking Add a test case for 3 values of x: MAX+1, MAX-1 and MAX Compound Boundaries When several variables have combined boundaries if (x < MAX) { Source: Adapted from McConnell 2004, p506-508 for (i=0; i<num; i++) { if (a[i] < LIMIT) { y = y+a[i]; boundary! below! max! Test when lots of array entries are close to LIMIT? Test when lots of entries are close to zero? max! boundary! below! max! 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10 5

Generating Tests from Use Cases Customer! Buy a Product Buy a! Product! Precondition: Customer has successfully logged in! Main Success Scenario:! 1. Customer browses catalog and selects items to buy! 2. Customer goes to check out! 3. Customer fills in shipping information (address, 1-day or 3-day)! 4. System presents full pricing information! 5. Customer fills in credit card information! 6. System authorizes purchase! 7. System confirms sale immediately! 8. System sends confirming email to customer! Postcondition: Payment was received in full, customer has received confirmation! Extensions:! 3a: Customer is Regular Customer:!.1 System displays current shipping, pricing and billing information!.2 Customer may accept or override defaults, cont MSS at step 6! 6a: System fails to authorize credit card!.1 Customer may reenter credit card information or may cancel! 1 Test the Basic Flow 2 Test the Alternate Flows Alternate Flow 3! Alternate! Flow 4! End Use Case! Start Use Case! Basic Flow! End Use Case! Alternate Flow 1! Alternate! Flow 2! End Use Case! 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11 Generating Tests from Use Cases Customer! Buy a Product Buy a! Product! Precondition: Customer has successfully logged in! Main Success Scenario:! 1. Customer browses catalog and selects items to buy! 2. Customer goes to check out! 3. Customer fills in shipping information (address, 1-day or 3-day)! 4. System presents full pricing information! 5. Customer fills in credit card information! 6. System authorizes purchase! 7. System confirms sale immediately! 8. System sends confirming email to customer! Postcondition: Payment was received in full, customer has received confirmation! Extensions:! 3a: Customer is Regular Customer:!.1 System displays current shipping, pricing and billing information!.2 Customer may accept or override defaults, cont MSS at step 6! 6a: System fails to authorize credit card!.1 Customer may reenter credit card information or may cancel! 3 Test the Postconditions Are they met on all paths through the use case? Are all postconditions met? 4 Break the Preconditions What happens if this is not met? In what ways might it not be met? 5 Identify options for each input choice select combinations of options for each test case 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 12 6

Classes of Bad Data Too little data (or no data) Too much data The wrong kind of data (invalid data) The wrong size of data Uninitialized data Data Classes Source: Adapted from McConnell 2004, p506-508 Classes of Good Data Nominal cases - middle of the road, expected values Minimum normal configuration Maximum normal configuration Compatibility with old data 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13 Classes of input variables Values that trigger alternative flows e.g. invalid credit card e.g. regular customer Trigger different error messages e.g. text too long for field e.g. email address with no @ Inputs that cause changes in the appearance of the UI e.g. a prompt for additional information Inputs that cause different options in dropdown menus e.g. US/Canada triggers menu of states/ provinces Cases in a business rule e.g. No next day delivery after 6pm Border conditions if password must be min 6 characters, test password of 5,6,7 characters Check the default values e.g. when cardholderʼs name is filled automatically Override the default values e.g. when the user enters different name Enter data in different formats e.g. phone numbers: (416) 555 1234 416-555-1234 416 555 1234 Test country-specific assumptions e.g. date order: 3/15/12 vs. 15/3/12 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14 7

Limits of Use Cases as Test Cases Use Case Tests good for: User acceptance testing Business as usual functional testing Manual black-box tests Recording automated scripts for common scenarios Limitations of Use Cases Likely to be incomplete Use cases donʼt describe enough detail of use Gaps and inconsistencies between use cases Use cases might be out of date Use cases might be ambiguous Defects you wonʼt discover: System errors (e.g. memory leaks) Things that corrupt persistent data Performance problems Software compatibility problems Hardware compatibility problems 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15 Quick Tests A quick, cheap test e.g. Whittaker How to Break Software Examples: The Shoe Test (key repeats in any input field) Variable boundary testing Variability Tour: find anything that varies, and vary it as far as possible in every dimension 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 16 8

Whittakerʼs QuickTests Explore the input domain 1. Inputs that force all the error messages to appear 2. Inputs that force the software to establish default values 3. Explore allowable character sets and data types 4. Overflow the input buffers 5. Find inputs that may interact, and test combinations of their values 6. Repeat the same input numerous times Explore the outputs 7. Force different outputs to be generated for each input 8. Force invalid outputs to be generated 9. Force properties of an output to change 10.Force the screen to refresh Explore stored data constraints 11. Force a data structure to store too many or too few values 12.Find ways to violate internal data constraints Explore feature interactions 13.Experiment with invalid operator/ operand combinations 14.Make a function call itself recursively 15.Force computation results to be too big or too small 16.Find features that share data Vary file system conditions 17.File system full to capacity 18.Disk is busy or unavailable 19.Disk is damaged 20.invalid file name 21.vary file permissions 22.vary or corrupt file contents 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 17 Interference Testing Generate Interrupts From a device related to the task From a device unrelated to the task From a software event Change the context Swap out the CD Change contents of a file while program is reading it Change the selected printer Change the video resolution Swap out the task Change focus to another application Load the processor with other tasks Put the machine to sleep Swap out a related task Compete for resources Get the software to use a resource that is already being used Run the software while another task is doing intensive disk access Cancel a task Cancel at different points of completion Cancel a related task Pause the task Pause for short or long time 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 18 9

Exploratory Testing Start with idea of quality: Quality is value to some person So a defect is: something that reduces the value of the software to a favoured stakeholder or increases its value to a disfavoured stakeholder Testing is always done on behalf of stakeholders Which stakeholder this time? e.g. programmer, project manager, customer, marketing manager, attorney What risks are they trying to mitigate? You cannot follow a script It s like a crime scene investigation Follow the clues Learn as you go Kaner s definition: Exploratory testing is a style of software testing that emphasizes personal freedom and responsibility of the tester to continually optimize the value of their work by treating test-related learning, test design, and test execution as mutually supportive activities that run in parallel throughout the project 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 19 Things to Explore Function Testing: Test what it can do. Domain Testing: Divide and conquer the data. Stress Testing: Overwhelm the product. Flow Testing: Do one thing after another. Scenario Testing: Test to a compelling story. Claims Testing: Verify every claim. User Testing: Involve the users. Risk Testing: Imagine a problem, then find it. Automatic Testing: Write a program to generate and run a zillion tests. 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 20 10