Paul Ammann & Jeff Offutt

Slides:



Advertisements
Similar presentations
Acceptance Testing.
Advertisements

Introduction to Software Testing Chapter 9.2 Challenges in Testing Software – Software Testability Paul Ammann & Jeff Offutt
Alternate Software Development Methodologies
Agile Requirements Methods CSSE 371 Software Requirements and Specification Mark Ardis, Rose-Hulman Institute October 26, 2004.
Test-Driven Development “Test first, develop later!” –OCUnit.
Chapter 3 Software Processes.
By for Test Driven Development: Industry practice and teaching tool Robert Vanderwall, Ph.D. 1 WISTPC-15.
CS 360 Lecture 3.  The software process is a structured set of activities required to develop a software system.  Fundamental Assumption:  Good software.
Identify steps for understanding and solving the
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
Rapid software development 1. Topics covered Agile methods Extreme programming Rapid application development Software prototyping 2.
Test-Driven Development Eduard Miric ă. The problem.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  System and Software  System Engineering  Software Engineering  Software Engineering Standards  Software Development.
Ch7: Software Production Process. 1 Waterfall models  Invented in the late 1950s for large air defense systems, popularized in the 1970s  Main characteristics:
Introduction to Software Testing (2nd edition) Chapter 4 Putting Testing First Paul Ammann & Jeff Offutt August.
Refactoring and Integration Testing or Strategy, introduced reliably by TDD The power of automated tests.
Lectures 2 & 3: Software Process Models Neelam Gupta.
Software Maintenance1 Software Maintenance.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
TDD Unit tests from a slightly different point of view Katie Dwyer.
Chapter 3 Agile software development 1 Chapter 3 – Agile Software Development.
A Method for Improving Code Reuse System Prasanthi.S.
CS223: Software Engineering
Software Development.
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction Edited by Enas Naffar using the following textbooks: - A concise introduction to Software Engineering - Software Engineering for students-
8.4 Management of Postdelivery Maintenance
Developer Testing Tricks
John D. McGregor Session 9 Testing Vocabulary
Integrate Agile Testing into the Process
Chapter 18 Maintaining Information Systems
Putting Testing First CS 4501 / 6501 Software Testing
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
Chapter 8 – Software Testing
Paul Ammann & Jeff Offutt
Software Processes (a)
Chapter 2 SW Process Models
Introduction Edited by Enas Naffar using the following textbooks: - A concise introduction to Software Engineering - Software Engineering for students-
Johanna Rothman Create Technical Excellence Chapter 9
Introduction to Software Testing Chapter 2 Model-Driven Test Design
Paul Ammann The Agile Heresy: What Drives Traditional Software Engineering, and Why Agile Turns it Upside Down Paul Ammann.
Johanna Rothman Know What “Done” Means Chapter 11
Test Driven Lasse Koskela Chapter 2: Beginning TDD
Paul Ammann & Jeff Offutt
Introduction to Software Testing
Chapter 2 Software Processes
Lecture 09:Software Testing
Testing and Test-Driven Development CSC 4700 Software Engineering
Putting Testing First CS 4501 / 6501 Software Testing
Test Driven Lasse Koskela Chapter 9: Acceptance TDD Explained
Software Testing and Maintenance Maintenance and Evolution Overview
The presentation can only be copied or altered for non-commercial personal or educational use. © Citizenship Foundation Charity Reg No
Introduction to Software Testing (2nd edition) Chapter 4 TDD Example
Software & Systems Quality Conferences United Kingdom 2006
Test Driven Lasse Koskela Chapter 2: Beginning TDD
Chapter 3 – Agile Software Development
CS310 Software Engineering Lecturer Dr.Doaa Sami
Norman 7 B: Improving Data Entry
CS310 Software Engineering Dr.Doaa Sami Khafaga
Chapter 8 Software Evolution.
Managing the Test Process CS 4501 / 6501 Software Testing
Test Driven Lasse Koskela Chapter 9: Acceptance TDD Explained
Move from Scripted Manual Testing to Scenario-Based Testing
Extreme Programming.
Chapter 7 Software Testing.
Refactoring Low Level/High Level.
User-Centered Design Data Entry CS 4640 Programming Languages for Web Applications [The Design of Everyday Things, Don Norman, Ch 7]
Extreme Programming (and Pair Programming)
User-Centered Design Data Entry CS 4640 Programming Languages for Web Applications [The Design of Everyday Things, Don Norman, Ch 7]
Presentation transcript:

Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwaretest/ Introduction to Software Testing (2nd edition) Chapter 4 Putting Testing First Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwaretest/ February 2018

The Increased Emphasis on Testing Philosophy of traditional software development methods Upfront analysis Extensive modeling Reveal problems as early as possible More work must be revised Root problem is harder to find Cost Delta Time Original Revision Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Traditional Assumptions Modeling and analysis can identify potential problems early in development Savings implied by the cost-of-change curve justify the cost of modeling and analysis over the life of the project These are true if requirements are always complete and current But customers always change their minds! Humans are naturally good at approximating But pretty bad at perfecting These two assumptions have made software engineering frustrating and difficult for decades Thus, agile methods … Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Why Be Agile ? Agile methods start by recognizing that neither assumption is valid for many current software projects Software engineers are not good at developing requirements We do not anticipate many changes Many of the changes we do anticipate are not needed Requirements (and other “non-executable artifacts”) tend to go out of date very quickly We seldom take time to update them Many current software projects change continuously Agile methods expect software to start small and evolve over time Embraces software evolution instead of fighting it Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Supporting Evolutionary Design Traditional design advice says to anticipate changes Designers often anticipate changes that don’t happen Anticipated Change Anticipated change that doesn’t happen Evolving Design Unanticipated Change Both anticipated and unanticipated changes affect design Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

The Test Harness as Guardian (4.2) What is Correctness ? Traditional Correctness (Universal) V x,y, x ≥ y Agile Correctness (Existential) X Y 1 5 10 { (1, 1)  T (1, 0)  T (0, 1)  F (10, 5)  T (10, 12)  F } Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

A Limited View of Correctness In traditional methods, we try to define all correct behavior completely, at the beginning What is correctness? Does “correctness” mean anything in large engineering products? People are VERY BAD at completely defining correctness In agile methods, we redefine correctness to be relative to a specific set of tests If the software behaves correctly on the tests, it is “correct” Instead of defining all behaviors, we demonstrate some behaviors Mathematicians may be disappointed at the lack of completeness But software engineers ain’t mathematicians! Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

In-Class Exercise limited correctness Discuss Do you understand the distinction? How does limited correctness relate to evolutionary design? You have ten minutes Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Test Harnesses Verify Correctness A test harness runs all automated tests and reports results to the developers Tests must be automated Test automation is a prerequisite to test driven development Every test must include a test oracle that can evaluate whether that test executed correctly The tests replace the requirements Tests must be high quality and must run quickly We run tests every time we make a change to the software Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Continuous Integration Agile methods work best when the current version of the software can be run against all tests at any time A continuous integration server rebuilds the system, returns, and reverifies tests whenever any update is checked into the repository Mistakes are caught earlier Other developers are aware of changes early The rebuild and reverify must happen as soon as possible Thus, tests need to execute quickly A continuous integration server doesn’t just run tests, it decides if a modified system is still correct Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Continuous Integration Reduces Risk TDD encourages incremental integration of functionality Non-integrated functionality is dangerous Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Sometimes called red-green-refactor Build It Right: TDD Test-Code-Refactor: The heart-beat The rule: Only write code to fix a failing test Traditional development cycle Test-driven development cycle Design Code Test Test Code Refactor Sometimes called red-green-refactor Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Start with one concrete client interaction Build It Right: TDD First, we write a test This really amounts to design by example We make decisions about how the Application Programmer Interface (API) works Class name, method names, return results, etc. This is essentially the user interface We’re thinking hard about how code is used We’re taking a client perspective We’re working at a very small scale Example for a stack stack = … ; stack.push (x); y = stack.pop(); assertEquals (x, y); Start with one concrete client interaction Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Goal: Make code base (just) pass test suite Build It Right: TDD Then we write just enough code We don’t write more code All we want is to make the test pass It should be a very small gap Implementation probably not optimal We don’t care (yet) Goal: Make code base (just) pass test suite Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

New ways to apply standard lessons Build It Right: TDD And then we refactor TDD without refactoring just makes ugly code Thoroughly tested, but ugly We have numerous transformations to address this Developing in small increments The code always runs! Changes are small enough to fit in our heads Time-frame is minutes to (maybe) hours Evolutionary design Anticipated vs unanticipated changes Many “anticipated changes” turn out to be unnecessary New ways to apply standard lessons Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Focus is on current code, not future code Build It Right: TDD Keeping code healthy with refactoring Refactoring is disciplined Wait for a problem before solving it Refactorings are transformations Many refactorings are simply applications of patterns Refactorings alter internal structure Refactorings preserve behavior Refactoring: A disciplined technique for restructuring an existing body of code, and altering its internal structure without changing its external behavior Focus is on current code, not future code Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

User Stories A user story is a few sentences that capture what a user will do with the software Agent sees a list of today’s interview applicants Withdraw money from checking account Support technician sees customer’s history on demand In the language of the end user Usually small in scale with few details Not archived Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Acceptance Tests in Agile Methods (Failing) User Story TDD Test 1 Change software & Refactor Tests archived Acceptance Test (Passing) Continue adding TDD tests until acceptance test passes TDD Test 2 Change software & Refactor Refactoring avoids maintenance debt Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

NO! The Testing Shortfall Do TDD tests (acceptance or otherwise) test the software well? Do the tests achieve good coverage on the code? Do the tests find most of the faults? If the software passes, should management feel confident the software is reliable? NO! Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

The agile methods literature does not give much guidance Why Not? Most agile tests focus on “happy paths” What should happen under normal use They often miss things like Confused-user paths Creative-user paths Malicious-user paths The agile methods literature does not give much guidance Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt

Summary More companies are putting testing first This can dramatically decrease cost and increase quality A different view of “correctness” Restricted but practical Embraces evolutionary design TDD is definitely not test automation Test automation is a prerequisite to TDD TDD tests aren’t enough Introduction to Software Testing, Edition 2 (Ch 4) © Ammann & Offutt