Global Constraints in Software Testing Applications

From this document you will learn the answers to the following questions:

What usually very large input space is usually very large?

What does software testing need to understand to create interesting test cases?

What number is Global Constraints in Software Testing Applications?

Similar documents
A Tool for Generating Partition Schedules of Multiprocessor Systems

Static Program Transformations for Efficient Software Model Checking

Chair of Software Engineering. Software Verification. Assertion Inference. Carlo A. Furia

InvGen: An Efficient Invariant Generator

A Constraint Programming based Column Generation Approach to Nurse Rostering Problems

Efficient and Robust Allocation Algorithms in Clouds under Memory Constraints

A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation

The Problem of Scheduling Technicians and Interventions in a Telecommunications Company

Approximation Algorithms

Branch-and-Price Approach to the Vehicle Routing Problem with Time Windows

Automated Detection of Non-Termination and NullPointerExceptions for Java Bytecode

Clustering and scheduling maintenance tasks over time

A Constraint Programming Application for Rotating Workforce Scheduling

Model Checking: An Introduction

GameTime: A Toolkit for Timing Analysis of Software

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Ant Colony Optimization and Constraint Programming

On the Modeling and Verification of Security-Aware and Process-Aware Information Systems

Vivek Sarkar Rice University. Work done at IBM during

Know or Go Practical Quest for Reliable Software

AUTOMATED TEST GENERATION FOR SOFTWARE COMPONENTS

Context-Bounded Model Checking of LTL Properties for ANSI-C Software. Jeremy Morse, Lucas Cordeiro, Bernd Fischer, Denis Nicole

FROM SAFETY TO SECURITY SOFTWARE ASSESSMENTS AND GUARANTEES FLORENT KIRCHNER (LIST)

Heuristics for Dynamically Adapting Constraint Propagation in Constraint Programming

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

Automated Product Line Methodologies to Support Model-Based Testing

High-performance local search for planning maintenance of EDF nuclear park

Combining Static Analysis and Test Generation for C Program Debugging

STUDY OF PROJECT SCHEDULING AND RESOURCE ALLOCATION USING ANT COLONY OPTIMIZATION 1

An Improvement Technique for Simulated Annealing and Its Application to Nurse Scheduling Problem

Application of Adaptive Probing for Fault Diagnosis in Computer Networks 1

The software model checker BLAST

#820 Computer Programming 1A

A hybrid approach for solving real-world nurse rostering problems

5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

Specification and Analysis of Contracts Lecture 1 Introduction

Offline sorting buffers on Line

Regression Verification: Status Report

The Software Model Checker BLAST: Applications to Software Engineering

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

Achieving Domain Consistency and Counting Solutions for Dispersion Constraints

Coverability for Parallel Programs

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

A Global Constraint for Bin-Packing with Precedences: Application to the Assembly Line Balancing Problem.

TEST CASE SELECTION & PRIORITIZATION USING ANT COLONY OPTIMIZATION

Dsc+Mock: A Test Case + Mock Class Generator in Support of Coding Against Interfaces

AUTOMATED SOFTWARE TEST DATA GENERATION: DIRECTION OF RESEARCH

FPGA area allocation for parallel C applications

Constraint Programming. Master Parisien de Recherche en Informatique

A CP Scheduler for High-Performance Computers

Solving the Vehicle Routing Problem with Multiple Trips by Adaptive Memory Programming

Testing LTL Formula Translation into Büchi Automata

(67902) Topics in Theory and Complexity Nov 2, Lecture 7


Scheduling Single Machine Scheduling. Tim Nieberg

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

Warshall s Algorithm: Transitive Closure

Two objective functions for a real life Split Delivery Vehicle Routing Problem

R u t c o r Research R e p o r t. A Method to Schedule Both Transportation and Production at the Same Time in a Special FMS.

Simulink Modeling Guidelines for High-Integrity Systems

ANT COLONY OPTIMIZATION ALGORITHM FOR RESOURCE LEVELING PROBLEM OF CONSTRUCTION PROJECT

Introduction to Scheduling Theory

Good FORTRAN Programs

Guessing Game: NP-Complete?

Numerology - A Case Study in Network Marketing Fractions

introduction to program monitoring

Cloud Branching. Timo Berthold. joint work with Domenico Salvagnin (Università degli Studi di Padova)

The Road from Software Testing to Theorem Proving

Computer Programming I

Scalable Load Balancing in Nurse to Patient Assignment Problems

Linear Programming. Widget Factory Example. Linear Programming: Standard Form. Widget Factory Example: Continued.

Dimensioning an inbound call center using constraint programming

Verifying Real-Time Embedded Software by Means of Automated State-based Online Testing and the SPIN Model Checker Application to RTEdge Models

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

M. Sugumaran / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 2 (3), 2011,

The Model Checker SPIN

Software Verification: Infinite-State Model Checking and Static Program

IKOS: A Framework for Static Analysis based on Abstract Interpretation (Tool Paper)

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

npsolver A SAT Based Solver for Optimization Problems

FoREnSiC An Automatic Debugging Environment for C Programs

Supply planning for two-level assembly systems with stochastic component delivery times: trade-off between holding cost and service level

QoS optimization for an. on-demand transportation system via a fractional linear objective function

A genetic algorithm for resource allocation in construction projects

Converting Models from Floating Point to Fixed Point for Production Code Generation

Applied Algorithm Design Lecture 5

Formal Verification and Linear-time Model Checking

Master of Science in Computer Science

Static analysis of numerical programs

How To Improve Autotest

Solving the chemotherapy outpatient scheduling problem with constraint programming

The Bi-Objective Pareto Constraint

vii TABLE OF CONTENTS CHAPTER TITLE PAGE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK

Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

A Test Suite for Basic CWE Effectiveness. Paul E. Black.

Implementing Ant Colony Optimization for Test Case Selection and Prioritization

Fault Analysis in Software with the Data Interaction of Classes

Transcription:

Global Constraints in Software Testing Applications Arnaud Gotlieb Simula Research Laboratory Norway 1/34

The Certus Centre Software Validation and Verification Cisco Systems Norway Hosted by SIMULA Established and awarded SFI in Oct. 2011 Norwegian Custom and excise duration: 8 years ABB Robotics Stavanger www.certus-sfi.no Kongsberg Maritime

Agenda I. Software Testing II. III. Optimal Test Suite Reduction Automatic Test Case Generation IV. Conclusions and Perspectives

Software Testing User Exigences Requirements Verdict: Pass or Fail Informal World Logical and Mathematical World Spec / Model Constraint Model Oracle Real World Test cases Software Under Test Results

Software Testing Software test preparation is a cognitively complex task: - Requires to understand both model and code to create interesting test cases ; - Program s input space is usually very large (sometimes unbounded) ; - Complex software (e.g., implementing ODEs or PDEs) yields to complex bugs ; - Test oracles are hard to define (non-testable programs) ; Not easily amenable to automation: - Automatic test data generation is undecideable in the general case! - Exploring the input space yields to combinatorial explosion ; - Fully automated oracles are usually not available ;

How software testing differs from other program verification techniques? Static analysis finds simple faults (division-by-zero, overflows, ) at compile-time, while software testing finds functional faults at run-time (P returns 3 while 2 was expected) Program proving aims at formally proving mathematical invariants, while software testing evaluates the program in its execution environment Model-checking explores paths of a model of the software under test for checking temporal properties or finding counter-examples, while software testing is based on program executions

Some Hot Research Topics in Software Testing Automatic test case generation Find test cases to exercise specific behaviors, to execute specific code locations, to cover some test objectives (e.g., all-statements, all-k-paths) Test suite reduction, test suite prioritization, test execution scheduling Robustness and performence testing Testing complex code (e.g., floating-point and iterative computations) Our thesis: Global constraints can efficiently tackle these problems! (High-level primitives with specialised filtering algorithms)

Optimal Test Suite Reduction

Optimal TSR: the core problem TC1 F1 F2 TC2 TC3 TC4 Optimal TSR F3 TC5 TC6 Optimal TSR: find a minimal subset of TC such that each F is covered at least once (Practical importance but NP-hard problem!) An instance of Minimum Set Cover

The nvalue global constraint Where: nvalue( n, v) n is an FD_variable v = (v 1,, v k ) is a vector of FD_variables nvalue(n, v) holds iff n = card( v i i in 1.. k) Introduced in [Pachet and Roy 99], first filtering algorithm in [Beldiceanu 01] Solution existence for nvalue is NP-hard [Bessiere et al. 04]

Optimal TSR: CP model with nvalue (1) TC1 F1 TC2 F2 TC3 TC4 F3 F 1 in {1, 2, 6}, F 2 in {3, 4}, F 3 in {2, 5} nvalue( MaxNvalue, (F 1, F 2, F 3 ) ), label(minimize(maxnvalue)) TC5 TC6 Optimal TSR /* branch-and-bound search among feasible solutions */

The global_cardinality constraint Where gcc( t, d, v) t = (t 1,, t N ) is a vector of N variables, each t j in Min j.. Max j d = (d 1,., d k ) is a vector of k values v = (v 1,, v k ) is a vector of k variables, each v i in Min i..max i gcc(t, d, v) holds iff i in 1.. k, v i = card( t j = di j in 1.. N) Filtering algorithms for gcc are based on max flow computations in a network flow [Regin AAAI 96]

Example TC1 gcc( (F 1, F 2, F 3 ), (1,2,3,4,5,6), (V 1,V 2,V 3,V 4,V 5,V 6 )) means that: In a solution of TSR TC 1 covers exactly V 1 requirements in (F 1, F 2, F 3 ) TC 2 V 2 TC 3 V 3... Where F 1, F 2, F 3, V 1, V 2, V 3,... denote finite-domain variables F1 F2 F3 TC2 TC3 TC4 TC5 TC6 F 1 in {1, 2, 6}, F 2 in {3, 4}, F 3 in {2, 5} V 1 in {0, 1}, V 2 in {0, 2}, V 3 in {0, 1}, V 4 in {0, 1}, V 5 in {0, 1}, V 6 in {0, 1} Here, for example, V 1 = 1, V 2 = 2, V 3 = 1, V 4 = 0, V 5 = 0, V 6 = 0 is a feasible solution But, not an optimal one!

Optimal TSR: CP model with two gcc (2) [Gotlieb Marijan ISSTA 2014] TC1 F1 TC2 F2 TC3 TC4 F3 TC5 F 1 in {1, 2, 6}, F 2 in {3, 4}, F 3 in {2, 5} gcc( (F 1, F 2, F 3 ), (1,2,3,4,5,6), (V 1, V 2, V 3, V 4, V 5, V 6 ) ), gcc((v 1, V 2, V 3, V 4, V 5, V 6 ), (0-_), (Max0Req-_ )), label(maximize(max0req)) TC6 Optimal TSR /* search heuristics by enumerating the Vi first */

Introducing model pre-treatment TC1 F 1 in {1, 2, 6} F 1 = 2 as cov(tc 1 ) = cov(tc 6 ) cov(tc 2 ) withdraw TC 1 and TC 6 F 3 is covered withdraw TC 5 F1 F2 TC2 TC3 TC4 F 2 in {3,4} e.g., F 2 = 3, withdraw TC 4 F3 TC5 Three such pre-treatment rules have been identified and can be included to simplify the problem TC6 But, they are currently statically applied!

/* + pre-treatment + labelling heuristics based on max */ 3. Optimal TSR: CP model Mixt (3) TC1 F1 TC2 F2 TC3 TC4 F3 TC5 F 1 in {1, 2, 6}, F 2 in {3, 4}, F 3 in {2, 5} gcc( (F 1, F 2, F 3 ), (1,2,3,4,5,6), (V 1, V 2, V 3, V 4, V 5, V 6 ) ), nvalue(maxnvalue, (V 1, V 2, V 3, V 4, V 5, V 6 )), label(minimize(maxnvalue)) TC6 Optimal TSR

Model comparison on random instances (Reduced Test Suite percentage in 30sec of search)

Model comparison on random instances (CPU time to find a global optimum)

Comparison with other approaches (Reduced Test Suite percentage in 60 sec)

TITAN [Marijan et al. SPLC 13, SPLC 14] Variability model to describe a software product line Unoptimized test suite Optimized (reduced/ prioritized) test suite Industrial case studies: ABB, Cisco Diagnostic views, feature coverage

Automatic Test Case Generation

An example problem f( int i, ) { a. j = 100; while( i > 1) b. { j++ ; i-- ;} a f t b d. if( j > 500) e. value of i to reach e? d t f e Undecideable problem!

Path-oriented exploration f( int i, ) { a. j = 100; while( i > 1) b. { j++ ; i-- ;} d. if( j > 500) e. a f t b 1. Path selection e.g., (a-b) 14 - -d-e d t 2. Path condition generation (via symbolic exec.) j 1 =100, i 1 >1, j 2 =j 1 +1, i 2 =i 1-1, i 2 >1,, j 15 >500 f e 3. Path condition solving unsatisfiable FAIL Backtrack!

Constraint-based program exploration (Gotlieb et al. ISSTA 98) f( int i, ) { a. j = 100; while( i > 1) b. { j++ ; i-- ;} d. if( j > 500) e. 1. Program (under Static Single Assignment form) as constraints 2. Control dependencies generation; j 1 =100, i 3 1, j 3 > 500 3. Global constraint reasoning j 1 j 3 entailed unroll the loop 400 times i 1 in 401.. 2 31-1 a d f f t t b e No backtrack!

Program as constraints Type declaration: signed long x; x in -2 31..2 31-1 Assignments: i*=++i ; i 2 = (i 1 +1) 2 Memory and array accesses and updates (Charreteur et al. JSS 09, Bardin et al. CPAIOR 12): v=a[i] ( or p=mem[&p] ) variations of element/3 Control structures: dedicated global constraints Conditionnals (SSA) if D then C 1; else C 2 ite/6 Loops (SSA) while D do C w/5

Conditional as a global constraint: ite/6 0 if( x > 0 ) j 1 = 5; 1 2 j 2 = 18; 3 =. j 3 ite( x > 0, j 1, j 2, j 3, j 1 = 5, j 2 = 18 ) iff x > 0 j 1 = 5 j 3 = j 1 (x > 0) j 2 = 18 j 3 = j 2 ( x > 0 j 1 = 5 j 3 = j 1 ) (x > 0) j 2 = 18 j 3 = j 2 ( (x > 0) j 3 = j 2 ) x > 0 j 1 = 5 j 3 = j 1 Join( x > 0 j 1 = 5 j 3 = j 1, (x > 0) j 1 = 18 j 3 = j 2 ) Implemented as a global constraint: interface, awakening conditions, filtering algo.

While loop as a global constraint: w/5 v 3 = ( v 1, v 2 ) while( Dec ) body w(dec, V 1, V 2, V 3, body) iff Dec V3 V1 body V3 V1 w(dec, v 2,v new,v 3, body V2 Vnew ) Dec V3 V1 v 3 =v 1 (Dec V3 V1 body V3 V1 ) Dec V3 V1 v 3 =v 1 ( Dec V3 V1 v 3 =v 1 ) Dec V3 V1 body V3 V1 w(dec,v 2,v new,v 3,body V2 Vnew ) join(dec V3 V1 body V3 V1 w(dec,v 2,v new,v 3,body V2 Vnew ), Dec V3 V1 v 3 =v 1 )

f( int i ) { j = 100; while( i > 1) { j++ ; i-- ;} if( j > 500) w(dec, V 1, V 2, V 3, body) :- Dec V3 V1 body V3 V1 w(dec, v 2,v new,v 3, body V2 Vnew ) Dec V3 V1 v 3 =v 1 (Dec V3 V1 body V3 V1 ) Dec V3 V1 v 3 =v 1 ( Dec V3 V1 v 3 =v 1 ) Dec V3 V1 body V3 V1 w(dec,v 2,v new,v 3,body V2 Vnew ) join(dec V3 V1 body V3 V1 w(dec,v 2,v new,v 3,body V2 Vnew, Dec V3 V1 v 3 =v 1 ) i = 23, j 1 =100? no i in 401..2 31-1 w(i 3 > 1, (i,j 1 ), (i 2,j 2 ), (i 3,j 3 ), j 2 = j 3 + 1 i 2 = i 3-1) i 3 = 1, j 3 = 122 i 3 = 10? j 1 = 100, j 3 > 500?

Features of the w/5 relation It can be imbricated with other relations (e.g., nested loops w( cond 1, v 1,v 2,v 3, w(cond 2,...)) It handles unbounded loops Managed by the solver as any other constraint (its consistency is iteratively checked, awakening conditions, success/failure/suspension) By construction, w is unfolded only when necessary but w may NOT terminate! (only a semi-correct procedure) Join is implemented using Abstract Interpretation operators (interval union, Q-polyhedra weak-join operator, simple widening operators) (Gotlieb et al. CL 2000, Denmat et al. CP 2006)

EUCLIDE: Automatic Test Case Generation for C Programs [Gotlieb ICST 09, KER 12]

Conclusions Global constraints (existing ones or user-defined) can efficiently and effectively tackle difficult software testing problems experimental results and industrial case studies So far, only a few subset of existing global constraints have been explored for that purpose (e.g., nvalue, gcc, element, all_different, ) Some software testing problems require the creation of dedicated global constraints to facilitate disjunctive reasoning, case-based reasoning or probabilistic reasoning there is room for research in that area!

Perspectives More industrial case studies for demonstrating the potential of global constraints for software testing applications Using GCC WITH COSTS to deal with bi-objective optimisation in test suite reduction (e.g., to also select test cases based on execution time in addition to reauirement coverage) Test Case Execution Scheduling with CUMULATIVE

Thanks to my co-authors: Bernard Botella (CEA) Mats Carlsson (SICS) Tristan Denmat (Inria) MariusLiaeen (CISCO) Dusica Marijan (SIMULA) Alexandre Pétillon (SIMULA)