Generating Automated Tests from Behavior Models

Slides:



Advertisements
Similar presentations
Introduction to Software Testing Chapter 9.2 Challenges in Testing Software – Software Testability Paul Ammann & Jeff Offutt
Advertisements

Of 23 Generating Automated Tests from Behavioral Models Jeff Offutt (Research with Dr. Nan Li, currently with MediData Solutions) Software Engineering.
Introduction to Software Testing Chapter 9.3 Challenges in Testing Software Test Criteria and the Future of Testing Paul Ammann & Jeff Offutt
Pedro Reales Mateo University of Castilla-La Mancha Alarcos Research Group University of Castilla-La Mancha Macario Polo Usaola University of Castilla-La.
1 SWE Introduction to Software Engineering Lecture 5.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
ISSRE 2006 | November 10, 2006 Automated Adaptive Ranking and Filtering of Static Analysis Alerts Sarah Heckman Laurie Williams November 10, 2006.
State coverage: an empirical analysis based on a user study Dries Vanoverberghe, Emma Eyckmans, and Frank Piessens.
Estimation Wrap-up CSE 403, Spring 2008, Alverson Spolsky.
CS527: (Advanced) Topics in Software Engineering Overview of Software Quality Assurance Tao Xie ©D. Marinov, T. Xie.
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 9.3 Challenges in Testing Software Test Criteria and the Future of Testing Paul Ammann & Jeff Offutt
CMSC 345 Fall 2000 Unit Testing. The testing process.
Department of CS and Mathematics, University of Pitesti State-based Testing is Functional Testing ! Florentin Ipate, Raluca Lefticaru University of Pitesti,
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
637 – Introduction (Ch 1) Introduction to Software Testing Chapter 1 Jeff Offutt Information & Software Engineering SWE 437 Software 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 UP MBT Extending the Unified Process with Model-Based Testing Fabrice Bouquet, Stéphane Debricon, Bruno Legeard and Jean-Daniel Nicolet MoDeV 2 a 2006.
Introduction to Software Testing Paul Ammann & Jeff Offutt Updated 24-August 2010.
Introduction to Software Testing. OUTLINE Introduction to Software Testing (Ch 1) 2 1.Spectacular Software Failures 2.Why Test? 3.What Do We Do When We.
Mutation Testing G. Rothermel. Fault-Based Testing White-box and black-box testing techniques use coverage of code or requirements as a “proxy” for designing.
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
Dynamic Testing.
Introduction to Software Testing Model-Driven Test Design and Coverage testing Paul Ammann & Jeff Offutt Update.
Software Testing and Quality Assurance Practical Considerations (1) 1.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Paul Ammann & Jeff Offutt
Regression Testing with its types
Testing Tutorial 7.
Deriving Test Data for Web Applications from User Session Logs
Test Automation CS 4501 / 6501 Software Testing
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Mutation Testing Moonzoo Kim School of Computing KAIST
Input Space Partition Testing CS 4501 / 6501 Software Testing
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Jeff Offutt SWE 637 Software Testing
Faults, Errors, Failures CS 4501 / 6501 Software Testing
Beyond Test Automation (Why Are My Tests Dumb?)
Introduction to Software Testing Chapter 5.1 Syntax-based Testing
How the Web Brought Evolution Back Into Design
Eclat: Automatic Generation and Classification of Test Inputs
Introduction to Software Testing Chapter 2 Model-Driven Test Design
It is great that we automate our tests, but why are they so bad?
Introduction to Software Testing Chapter 9.2 Program-based Grammars
From Spec-based Testing to Test Automation and Beyond
Software testing strategies 2
Paul Ammann & Jeff Offutt
Introduction to Software Testing
MBML_Efficient Testing Methodology for Machine Learning
Introduction to Software Testing Chapter 5.2 Program-based Grammars
Test Case Purification for Improving Fault Localization
Test Driven Lasse Koskela Chapter 9: Acceptance TDD Explained
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.
Jeff Offutt SWE 637 Software Testing
Decentralized Model-Based Testing of Distributed Systems
A Test Automation Language for Behavioral Models
Logic Coverage for Source Code CS 4501 / 6501 Software Testing
Scriptless Test Automation through Graphical User Interface
Mutation Testing Moonzoo Kim School of Computing KAIST
Software Testing COM /12/2019 Testing/Spring 98.
George Mason University
Paul Ammann & Jeff Offutt
Review for Final – Spring 2018
Review for Final – Spring 2019
Presentation transcript:

Generating Automated Tests from Behavior Models Jeff Offutt SWE 737 Advanced Software Testing

OUTLINE Overview of Model-Based Testing The Mapping Problem The Test Oracle Problem Summary & Conclusions SWE 737 © Jeff Offutt

Benefits of Model-Based Testing Better tests Lower cost Early detection of requirements defects Traceability Software evolution Less overlap among tests SWE 737 © Jeff Offutt

Model-Based Testing Process Lots of research and tools for: Test criteria Creating models Executing tests Model Criterion Test Requirements Abstract Tests Not much known about: Converting abstract tests to concrete tests Writing effective test oracles These are normally done by hand Extra Info Concrete Tests Test Oracle Test Execution Test Reports SWE 737 © Jeff Offutt

OUTLINE Overview of Model-Based Testing The Mapping Problem The Test Oracle Problem Summary & Conclusions SWE 737 © Jeff Offutt

Semi-automate the transformation The Mapping Problem Transform abstract tests to concrete tests An abstract test: AddChoc, Coin, GetChoc, Coin, AddChoc Nine edge coverage abstract tests use : 15 “AddChoc” transitions 16 “Coin” transitions 6 “getChoc” transitions Testers usually convert abstract to concrete tests by hand 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] Semi-automate the transformation SWE 737 © 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 SWE 737 © Jeff Offutt

Solving the Mapping Problem A language to define mappings for individual test components Structured Test Automation Language (STAL) A tool to choose model-level test components and compose mappings to create concrete tests Behavioral Models Identifiable Elements Transitions Objects Constraints SWE 737 © Jeff Offutt

Empirical Evaluation of STALE Can STALE help programmers efficiently design tests ? Subject Programs 17 open source and example programs 52 to 9486 LOC 7 GUIs, 4 web apps, 1 CL, 5 others Subject Models Drawn using Eclipse / Papyrus 7—22 states 12—116 transitions Participants 9 professional developers / graduate students SWE 737 © Jeff Offutt

STALE vs. Hand Test Generation Generating Tests by Hand Write tests by hand Ensure that constraints in models were satisfied Compile and run the tests Generating Test with STALE Import model and program into STALE Create test component mappings by hand STALE creates concrete tests to satisfy transition (edge) coverage Measurements Time Number of errors in tests SWE 737 © Jeff Offutt

Mapping Problem Results 48 errors with manual approach, 0 with STALE SWE 737 © Jeff Offutt

OUTLINE Overview of Model-Based Testing The Mapping Problem The Test Oracle Problem Summary & Conclusions SWE 737 © Jeff Offutt

RIPR Model Reachability Infection Propagation Revealability Test Final Program State Reaches Observed Final Program State Fault Incorrect Final State Incorrect Final State Infects Incorrect Program State Propagates The failures can be revealed when the observed final program state has overlap with the incorrect final program state. The question is: should testers check the entire program state? How to observe the incorrect program state in a cost-effective manner. Getting the overlap as big as possible and use the cost as small as possible. Reveals Test Oracles SWE 737 © Jeff Offutt

An automated test must check whether the behavior was correct Test Oracle Problem An automated test must check whether the behavior was correct (assertions in Junit) How much of the program state should be checked ? (That is, which variables ?) More checking adds more cost Method return values ? Method parameters ? Global variables ? How often should state be checked ? Once at end of test ? After every transition ? SWE 737 © 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 OS4 SI params OS5 SI objects returns params Can be created from mappings Free SWE 737 © Jeff Offutt

Empirical Evaluation of Test Oracle Strategies Do more precise OSes reveal more failures ? Do more frequent checks reveal more failures ? Which OS balances cost and effectiveness ? Subjects 16 Java programs & UML statecharts 24 test sets for each OS for edge coverage 9627 faults (mutants) generated using muJava Experimental Variables Independent : 13 oracle strategies Dependent : Cost (number of assertions) Faults revealed SWE 737 © Jeff Offutt

Precision—% Faults Revealed 28,881,000 tests executed (12 OSes * 250 tests * 9627 faults) More precise OSes are not always more effective One-tailed Wilcoxon signed-rank test SWE 737 © Jeff Offutt

Frequency—% Faults Revealed Checking after each transition vs. checking at the end of the test Multiple checks is not significantly more effective One-tailed Wilcoxon signed-rank test SWE 737 © Jeff Offutt

Test Oracle Strategy Findings NOS is useless—wastes much of testing effort 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 SWE 737 © Jeff Offutt

OUTLINE Overview of Model-Based Testing The Mapping Problem The Test Oracle Problem Summary & Conclusions SWE 737 © Jeff Offutt

Contributions in Context Model Criteria Test Requirements Abstract Tests Extra Info Concrete Tests Test Execution Test Reports A language like STAL can significantly ease the transformation of abstract tests to concrete tests Test Oracle Test oracles are effective with modest, but not zero, cost SWE 737 © Jeff Offutt

Summary of Contributions Algorithms for computing efficient test paths on models Language to partially automate mappings from abstract tests to concrete tests Based on assembling test components Demonstrated value of STAL over manual test automation Determined cost-effective test oracle strategy Extended classic RIP model to RIPR SWE 737 © Jeff Offutt

References Software Test Automation Practices in Agile Development Environment: An Industry Experience Report, Eliane Figueiredo Collins and Vicente Ferreira de Lucena, Jr., 7th International Workshop on Automation of Software Test, Pages 57-63, Zurich, Switzerland, June 2012 (Eric) Test Automation in the Real World—2016, (results from a survey monkey poll) New survey reveals test automation trends, Cecilia Rehn, Software Testing News August 2015 (summary of a longer article behind a pay wall) Test Oracle Strategies for Model-based Testing, Nan Li and Jeff Offutt, IEEE Transactions on Software Engineering, To appear, 2017 SWE 737 © Jeff Offutt