It is great that we automate our tests, but why are they so bad?

Slides:



Advertisements
Similar presentations
© SMARTESTING 2011 – This document is the property of Smartesting. It may not be reproduced in whole or in part Cliquez pour modifier le style du titre.
Advertisements

Introduction to Software Testing Chapter 1 Model-Driven Test Design Paul Ammann & Jeff Offutt
Verification and Validation
Introduction to Software Testing Chapter 2.6 Graph Coverage for Use Cases Paul Ammann & Jeff Offutt
Of 23 Generating Automated Tests from Behavioral Models Jeff Offutt (Research with Dr. Nan Li, currently with MediData Solutions) Software Engineering.
SOFTWARE PROJECT MANAGEMENT Project Quality Management Dr. Ahmet TÜMAY, PMP.
Introduction to Software Testing
Regression testing Tor Stållhane. What is regression testing – 1 Regression testing is testing done to check that a system update does not re- introduce.
State coverage: an empirical analysis based on a user study Dries Vanoverberghe, Emma Eyckmans, and Frank Piessens.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
An Introduction to MBT  what, why and when 张 坚
CMSC 345 Fall 2000 Unit Testing. The testing process.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
1 New Development Techniques: New Challenges for Verification and Validation Mats Heimdahl Critical Systems Research Group Department of Computer Science.
Introduction to Software Testing Chapter 8.1 Building Testing Tools –Instrumentation Paul Ammann & Jeff Offutt
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
Agile Test-based Modeling 資工 聶順成. Outline  Introduction : Modeling meets Programming  Agile Modeling: Using Models in Agile Projects  Model-based.
Of 18 Is Bytecode Instrumentation as Good as Source Instrumentation? An Empirical Study with Industrial Tools Nan Li, Xin Meng, Jeff Offutt, and Lin Deng.
1 Graph Coverage (6). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Design - programming Cmpe 450 Fall Dynamic Analysis Software quality Design carefully from the start Simple and clean Fewer errors Finding errors.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
Why Are My Tests Dumb? Jeff Offutt George Mason University.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Coupling-based Criteria for Integration Testing Journal of Software Testing, Verification, and Analysis, 8(3): , September 1998, Jenny Jin and Jeff.
Software Testing and Quality Assurance Practical Considerations (1) 1.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini XVIII. Software Testing.
Introduction to Software Testing Part1 Summary & Terms
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Module A Fundamentals of Testing
Regression Testing with its types
Testing Tutorial 7.
Generating Automated Tests from Behavior Models
Control Flow Testing Handouts
John D. McGregor Session 9 Testing Vocabulary
Test Automation CS 4501 / 6501 Software Testing
Chapter 18 Maintaining Information Systems
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Coverage-Based Test Design CS 4501 / 6501 Software Testing
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Beyond Test Automation (Why Are My Tests Dumb?)
John D. McGregor Session 9 Testing Vocabulary
Introduction to Software Testing Chapter 5.1 Syntax-based Testing
How the Web Brought Evolution Back Into Design
Verification and Validation
Introduction to Software Testing Chapter 2 Model-Driven Test Design
John D. McGregor Session 9 Testing Vocabulary
From Spec-based Testing to Test Automation and Beyond
Software testing strategies 2
Introduction to Software Testing
Introduction to Software Testing
Paul Ammann & Jeff Offutt
Fundamental Test Process
Software Testing and Maintenance Maintenance and Evolution Overview
Test Automation CS 4501 / 6501 Software Testing
ISP Coverage Criteria CS 4501 / 6501 Software Testing
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
(some of) My Research Engineering is about getting technology to do what it does well so humans can do what they do well Jeff Offutt Professor of Software.
Regression testing Tor Stållhane.
A Test Automation Language for Behavioral Models
Introduction to Software Testing Chapter 5.1 Syntax-based Testing
Scriptless Test Automation through Graphical User Interface
George Mason University
Test Cases, Test Suites and Test Case management systems
Computer Science 340 Software Design & Testing
Paul Ammann & Jeff Offutt
Presentation transcript:

It is great that we automate our tests, but why are they so bad? Jeff Offutt George Mason University Skövde University TOCSYC Project https://www.cs.gmu.edu/~offutt

TOCSYC Testing of Critical System Characteristics A distributed research environment

Who are we and what’s it all about? 5-year project ~30 MSEK ~15 senior funded researchers And several contributing affiliate members Our main goals To develop feasible testing techniques for performance efficiency and robustness To automate complex testing activities such as test case generation and test case prioritization To determine cost effectiveness of different testing approaches © Jeff Offutt

A strong collaborative research environment A mix of expertise and approaches Model-based testing Mutation-based techniques Search-based approaches Static analysis techniques Synergies between approaches explored E.g., model-based mutation testing 200+ research papers produced by TOCSYC researchers since project started in 2013 Both TOCSYC results and results from our other projects © Jeff Offutt

Background: Test Automation Test case management Source of tests Commonly automated in practice Test requirements generation Test value generation Test execution © Jeff Offutt

Background: Model-Based Testing Automate additional test generation steps Test case management Source of tests Models, usually behavioral (e.g., UML statecharts) This can be automated Test requirements generation Test value generation Test execution © Jeff Offutt

Model-Based Testing Process Test criterion Test requirements (subpaths) Abstract tests (test paths) Concrete tests Test oracles Model Criterion Test Requirements Abstract Tests Concrete Tests Extra Info Test Execution Test Reports © Jeff Offutt

Benefits of Model-Based Testing Better tests : Find more failures Lower cost : Fewer tests Traceability : Direct connection to design and code elements Early detection of requirements defects : Before coding Software evolution : Changes reflected directly in tests Less overlap : Each test evaluates something unique © Jeff Offutt

Challenges of Test Automation Controllability : Making sure we get our test values to the right places in the code Revealability : Making sure our test oracles look in the right place to see the failures Self-determination : Tests should be more self contained © Jeff Offutt

Controllability: Mapping Problem Transform abstract tests to concrete tests First abstract test: AddChoc, Coin, GetChoc, Coin, AddChoc Nine edge coverage abstract tests use : 15 “AddChoc” transitions 16 “Coin” transitions 6 “getChoc” transitions Testers often convert abstract to concrete tests by hand This is expensive! Solution? 1 2 3 4 Coin GetChoc AddChoc 1: credit = 0 & #stock = 0 2: credit > 0 & #stock = 0 3: credit = 0 & #stock > 0 4: credit > 0 & #stock > 0 AddChoc / Coin [1, 3, 4, 1, 2, 4] Automate the transformation © Jeff Offutt

Model-Based Test Components Each abstract test component must be mapped to real code in concrete tests Test 3 C4 C4 C4 many times C5 C5 C5 C6 C6 C7 C7 © Jeff Offutt

Component-based vs. By Hand Hand-based Generating Tests Write tests by hand Ensure that constraints in models were satisfied Compile and run the tests Component-based Test Generation Import model and program into a tool Create test component mappings by hand Tool creates concrete tests to satisfy transition (edge) coverage Empirical Evaluation Faster Fewer errors Joint work with Dr. Nan Li © Jeff Offutt

Challenges of Test Automation Controllability : Making sure we get our test values to the right places in the code Revealability : Making sure our test oracles look in the right place to see the failures Self-determination : Tests should be more self contained © Jeff Offutt

Test Oracle Problem An automated test must check whether the behavior was correct (assertions in Junit) Q1: How much of the program state should be checked ? (that is, which variables ? ) More checking adds more cost Q2: How often should state be checked ? Once at end of test ? After every transition ? © Jeff Offutt

Test Oracle Strategies f requency After each transition Once at end of test Requires analysis by tester precision NOS null (crash) SIOS state invariant (SI) OS1 SI member objects OS2 SI returns OS3 SI objects returns OS5 SI params OS6 SI objects returns params Can be created from mappings Free © Jeff Offutt

Precision—% Faults Revealed 28,881,000 tests executed (12 OSes * 250 tests * 9627 faults) More precise OSes are not always more effective © Jeff Offutt

Frequency—% Faults Revealed Checking after each transition vs. checking at the end of the test Multiple checks is not significantly more effective © Jeff Offutt

Test Oracle Strategy Findings Crash testing (NOS) wastes much of testing effort Penny wise, pound foolish The most cost-effective choice is to check the state invariants once at the end of the tests (SIOS) Only one check needed Can be partially derived automatically from the model Joint work with Dr. Nan Li © Jeff Offutt

Challenges of Test Automation Controllability : Making sure we get our test values to the right places in the code Revealability : Making sure our test oracles look in the right place to see the failures Self-determination : Tests should be more self contained © Jeff Offutt

These tests are as dumb as single-cell organisms !! Old Style Tests Values invented by humans Scripts were pieces of paper with steps Turn on computer Type : “Run myProgram” Enter name : “George P. Burdell” Enter age : “-25” Simple directions to humans Slow! Error prone! Limited repeatability! These tests are as dumb as single-cell organisms !! Almost impossible to integrate criteria © Jeff Offutt

Single-cell tests are incompatible with Limitations Single-cell tests are incompatible with model-based testing © Jeff Offutt

These multi-cellular tests show the first signs of intelligence! Modern Dumb Tests Test values Created by a mix of humans and test data generators Satisfy well-documented goals, test criteria, or specialized domain needs Integrated into automated test scripts (eg, JUnit) Includes a small amount of brain power … these tests know what results to expect (eg, JUnit assertions) Fast … repeatable … These multi-cellular tests show the first signs of intelligence! © Jeff Offutt

But this test does not know … Multicellular Tests But this test does not know … Test Values Expected results Before values After values Why is it there? When should it run? When should it change? When should it die? © Jeff Offutt

Intelligent tests need self-awareness and self-determination! © Jeff Offutt

Intelligent Tests Intelligent tests need self-awareness and self-determination! Each test should encode traceability … what it covers Tests should check what has changed, and rerun if necessary Tests should alert tester when they no longer match the software Tests should quietly go away when no longer needed © Jeff Offutt

Summary Test automation saves money Model-based testing saves more money Tests can be assembled from pieces It matters what the oracle checks Automated tests can be much better ! Jeff Offutt https://www.cs.gmu.edu/~offutt © Jeff Offutt