The Best Software Testing Arie Van Deursen TU Delft, 2011

Similar documents
COSC 3351 Software Design. Recap for the first quiz. Edgar Gabriel. Spring For the 1 st Quiz

Design by Contract beyond class modelling

Ingegneria del Software Corso di Laurea in Informatica per il Management. Object Oriented Principles

Lab work Software Testing

Software Testing. Motivation. People are not perfect We make errors in design and code

Co-Presented by Mr. Bill Rinko-Gay and Dr. Constantin Stanca 9/28/2011

Aspects for Testing Aspects?

ForeverSOA: Towards the Maintenance of Service-Oriented Architecture (SOA) Software

Techniques and Tools for Rich Internet Applications Testing

On the Relation between Design Contracts and Errors: A Software Development Strategy

Model-Based Spotify. Kristian Karl

Built-in Contract Testing in Model-driven, Component- Based Development

Software Engineering Techniques

Contents. Introduction and System Engineering 1. Introduction 2. Software Process and Methodology 16. System Engineering 53

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Agile Software Development

Course Number: IAC-SOFT-WDAD Web Design and Application Development

Jenkins User Conference Herzelia, July #jenkinsconf. Testing a Large Support Matrix Using Jenkins. Amir Kibbar HP

應 用 測 試 於 軟 體 發 展 生 命 週 期. Testing In The Software Development Life Cycle

Complete Web Application Security. Phase1-Building Web Application Security into Your Development Process

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Logistics. Software Testing. Logistics. Logistics. Plan for this week. Before we begin. Project. Final exam. Questions?

SOFTWARE TESTING. A Craftsmcm's Approach THIRD EDITION. Paul C. Jorgensen. Auerbach Publications. Taylor &. Francis Croup. Boca Raton New York

Rigorous Software Development CSCI-GA

National University of Ireland, Maynooth MAYNOOTH, CO. KILDARE, IRELAND. Testing Guidelines for Student Projects

How To Test Automatically

MOBILE APPLICATION TESTING ENGINEER

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

Lecture 17: Testing Strategies" Developer Testing"

Application Testing Suite Overview

Performance Testing Percy Pari Salas

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

UML-based Test Generation and Execution

Computing Concepts with Java Essentials

Integrating Big Data into the Computing Curricula

BUSINESS RULES MANAGEMENT AND BPM

Process of Performance Testing a Banking Application

TeCReVis: A Tool for Test Coverage and Test Redundancy Visualization

Tool-Assisted Unit-Test Generation and Selection Based on Operational Abstractions

Essential Visual Studio Team System

How To Write A Test Engine For A Microsoft Microsoft Web Browser (Php) For A Web Browser For A Non-Procedural Reason)

Introduction to Computers and Programming. Testing

Checking Access to Protected Members in the Java Virtual Machine

Engineering Design. Software. Theory and Practice. Carlos E. Otero. CRC Press. Taylor & Francis Croup. Taylor St Francis Croup, an Informa business

Environment Modeling for Automated Testing of Cloud Applications

Object Oriented Design

Tools for Integration Testing

Specification and Analysis of Contracts Lecture 1 Introduction

a. Inheritance b. Abstraction 1. Explain the following OOPS concepts with an example

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References

Software-platform-independent, Precise Action Specifications for UML. Stephen J. Mellor. Project Technology, Inc.

Software Test and Analysis in a Nutshell 資 科 系 林 偉 川

Test Plan Evaluation Model

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

Oracle Application Express MS Access on Steroids

Application of Predictive Analytics for Better Alignment of Business and IT

CS 2112 Spring Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

Model based testing tools. Olli Pekka Puolitaival

CS 451 Software Engineering Winter 2009

USE OF PYTHON AS A SATELLITE OPERATIONS AND TESTING AUTOMATION LANGUAGE

Software testing. Objectives

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

User-Centric Client Management with System Center 2012 Configuration Manager in Microsoft IT

A metrics suite for JUnit test code: a multiple case study on open source software

What Is Specific in Load Testing?

Testing of safety-critical software some principles

Applying 4+1 View Architecture with UML 2. White Paper

Test-Driven Approach for Safety-Critical Software Development

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Lecture 26 Enterprise Internet Computing 1. Enterprise computing 2. Enterprise Internet computing 3. Natures of enterprise computing 4.

Basic Testing Concepts and Terminology

Metrics in Software Test Planning and Test Design Processes

Programming by Contract vs. Defensive Programming: A Comparison of Run-time Performance and Complexity

Application Lifecycles: 2 case studies. Joris Van Looveren joris.van.looveren@volvo.com

Agile Test Automation. James Bach, Satisfice, Inc.

Know the Difference. Unified Functional Testing (UFT) and Lean Functional Testing (LeanFT) from HP

Siebel Application Deployment Manager Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

Architecture and Mode of Operation

Architecture Workshop

Advanced Test-Driven Development

Test Management and Techniques

System testing from UML diagrams

Apache Traffic Server Extensible Host Resolution

ARIS Design Platform Getting Started with BPM

Kirsten Sinclair SyntheSys Systems Engineers

Basic Unix/Linux 1. Software Testing Interview Prep

Unit Testing with Monkeys Karl-Mikael Björklid University of Jyväskylä Department of Mathematical Information Technology

Automating client deployment

Automated Validation & Verification of Software Paper Presentation

1735 East Bayshore Road, Suite 6B, Redwood City, CA

Agile Specification-Driven Development

Certified Software Quality Engineer (CSQE) Body of Knowledge

The ConTract Model. Helmut Wächter, Andreas Reuter. November 9, 1999

Adobe Flash Player and Adobe AIR security

Formal Engineering for Industrial Software Development

Upping the game. Improving your software development process

Software Requirements Specification

Basic Requirements...2. Software Requirements...2. Mailbox...2. Gatekeeper...3. Plan Your Setup...3. Meet Extreme Processing...3. Script Editor...

What is a life cycle model?

Transcription:

Favorite Picks in Software Testing Arie van Deursen TU Delft @avandeursen Kickoff presentation Test Week Stabiplan, 2011 1

Outline 1. Background 2. Test Strategies 3. Test Week Objectives 4. Selected Strategies Combinations, states, contracts, exceptions 5. Testing Research at TU Delft 6. Open Q & A 2

The TU Delft Software Engineering Research Group Education Programming, software engineering MSc, BSc projects Research Software architecture Software testing Repository mining Collaboration Services Model-driven engineering End-user programming 3

4

Software Testing An activity to assess the quality of a system Using simple scenarios that can be understood 5

Each test case is an executable example of system behavior Each example can help in stakeholder communication Throughout the full development cycle 6

The Set of Examples is Incomplete Too much data Too many combinations Too many paths Properties of interest fundamentally undecidable 7

Testing can be Manual or Automatic Manual Testing Clever test case design Interaction with system inspiration for new tests Human oracle Single test case execution Limited data Automated Testing Clever test case design Specs, models, & code used to derive test cases Automated oracle needed Test execution easily repeatable Massive input data possible Clearly, we need both 8

Manual Testing: Exploratory Software Testing Human tester, using brain, fingers, & wit to create scenarios that will cause software either to fail or to fulfill its mission. Take advantage of human cleverness No scripts: Exploratory Testing Record test findings as you go 9

10

Testing is about Varying Things: Input, State, Paths, Data, Environment Input: Atomic versus abstract Input combinations Order of inputs Legal versus illegal Input filters & checks Normal versus special Default / user supplied State History of stimuli Paths Routes through system Data Evolution over months Environment Simulate the real world 11

The Tour Metaphor Touring Guidebook tour Money tour Landmark tour After hours tour Museum tour Rained-out tour Couch potato tour Antisocial tour Testing Use the manual The money-generating features Key features Batch functionality Legacy features Start and then cancel operations Do as little as possible (all defaults) Known bad inputs http://blogs.msdn.com/b/james_whittaker/ 12

An evolving product needs automated testing Can we change a mosaic, tile by tile, in a team of 25+ developers and keep its structure? 13

Test Strategy System model Abstraction of system to reason about it Fault model Likely faults that can be related to system model Test procedure Systematic steps targeting likely faults via system model Adequacy criterion Measure to tell to what extent strategy has been applied 14

Test Adequacy 9.3 Functional All use cases All decision paths All states All boundary values... Structural All methods All statements All code branches All def-use pairs... Test adequacy criterion gives rise to test obligations. Test coverage: percentage of obligations that are met. 15

Test Week Objectives? Write test cases Achieve coverage goals Create / update models Identify relevant test strategies Analyze failures to identify root cause Rethink embedding of testing in dev. cycle Rethink design to improve testability 16

Combinatorial Testing What to do about the combinatorial explosion? M. Grindal, J. Offutt, S. F. Andler. Combination Testing Strategies: A survey. Software Testing, Verification, and Reliability, 15(2):97-133, 2005 Tests done (2.5 bill. y) 17

Input Handling / Combinational Testing 18

3-Way vs 2-Way Interaction full combi s: 2 3 = 8 triangles 19

Possible Pairwise Selection OS Server DB Win IIS Oracle Win Apache MySQL Linux Apache Oracle Win IIS MySQL Linux Apache MySQL 20

Pairwise Test Strategy System model: feature diagram Fault model: feature interactions Procedure: Each test case addresses N types of features Ensure all 2-way possibilities are addressed Unless impossible Adequacy: Percentage of pairs covered. 21

22

Random versus Pairwise Assume you need N test cases to achieve 100% pairwise coverage How high would pairwise coverage be for random set of N cases? around 95%! Bach & Schroeder, 2004 23

Statecharts Harel, 1987 Scaleable state diagrams OR & superstates AND & concurrency (Partly) incorporated in UML 24

(UML) State Diagrams State pop() / EmptyStackExc. Transition Empty Event push(x) pop() [n==1] [Condition] /Response push(x) [n < max-1] Loaded pop() [n>1] Initial state push(x) [n == max-1] pop() push(x) / FullStackExc. Full 25

State-Based Testing Strategy System model: Statechart Fault model: incorrect transitions or responses Procedure: Unfold loops into transition tree Cover all paths from root to leaf Adequacy: All roundtrip-paths Empty Loaded Full Empty2 Empty3 Loaded2 Loaded3 Full2 26

Built-in Testing During design, explicitly consider Preconditions Postconditions Class and other structural invariants Use assertions to enforce these at run time Increase fault sensitivity and redundancy Serve as oracle for (automated) testing 27

Design By Contract Contract metaphor: Contract is an explicit statement of the rights and obligations between a client and a server Server perspective: If you call me and meet my precondition, I ensure that after returning I deliver a state in which my postcondition holds If not, you re on your own. Bertrand Meyer, Applying "Design by Contract", IEEE Computer 25, 10, October 1992, pages 40-51 28

Base Invariant: I { P } M { Q } Derived Inheritance as Subcontracting Pre, post & invariants in subclass: Weaker precond: P P Require no more : P = P or P Invariant: I { P } M { Q } Stronger postcond: Ensure no less : Stronger invariant: Q Q Q = Q and Q I I

Polymorphic Server Test Strategy System model: class diagram Fault model Subtype breaks behavior Procedure: Parallel class hierarchy for testing With specialized factory methods Adequacy: Every subclass tested in context of superclass expectations 30

Example: Persistence in JHotDraw Storable write(output w); read(input r); Figure Drawing Drawing framework in Java Play garden for design patterns Each figure / drawing knows how to store / resurrect itself www.jhotdraw.org 31

Factory Method StorableTest void tstwriteread() Storable make() boolean equalsto() @Test void tstwriteread{ Storable s1 = make(); Storable s2 = make(); File f = new File(..); s1.write(output(f)); s2.read(input(f)); asserttrue( equalsto(s1, s2)); } FigureTest DrawingTest primitve operations template method Template Method 32

SRP: Single Responsibility One reason for change OCP: Open-Closed Implementation open Interface closed LSP: Liskov Substitution Behavioral subtyping ISP: Interface Segregation Multiple interfaces DIP: Dependency Inversion Hollywood

Contract Styles Tolerant (= Defensive) Server doesn t trust it s clients! Contract includes welldefined exceptions upon non-standard behavior Client can t break server Extensive server-side checking Usually: duplicate checking Demanding (for client) Server assumes it can trust it clients Lean, minimal contract Non-standard behavior not in contract Contract breach leads to undefined response No duplicate checking Bertrand Meyer, Applying "Design by Contract", IEEE Computer 25, 10, October 1992, pages 40-51 34

Testing for Exceptions Only if they re part of the contract Fault model: Incorrectly raised / thrown Incorrectly handled / caught System model: exception flow Procedure must address controllability: Stub interfaces to trigger exceptional conditions 35

Design for Testability Interfaces Tell, don t ask A mock keeps track of how it is used Test cases can set `expectations on, e.g. calls Dependency injection Mocking framework: http://jmock.org 36

Fighting Poor Testability I Can t Get This Class into a Test Harness. This Class Is Too Big and I Don t Want It to Get Any Bigger I Need To Make a Change but I Don t Know What Tests To Write. 37

Finale: Testing Research at TU Delft [ Selection ] 38

Crawljax: Testing Ajax Apps 39

Project: Checkstyle Monitoring The Testing Process A. Zaidman, B. van Rompaey, A. van Deursen and S. Demeyer. Studying the co-evolution of production and test code in open source and industrial developer test processes through repository mining. Empirical Software Engineering 16(3):325--364, 2011 40

Understanding Testing Processes in Eclipse 41

ETSE: Eclipse Test Suite Explorer

Summary Test case design = selecting examples Reflect on your strategies: Fault & system model, procedure, adequacy. Can you test interfaces, exceptions, combinations, state machines? 43

A Test Week Ahead of You! What testing do you want to do? What challenges do you expect? Which successes do you want to celebrate? 44