Efficient Techniques for Software Testing Jeff Lei April 13, 2007.

Slides:



Advertisements
Similar presentations
A Technique for Parallel Reachability Analysis of Java Programs Raghuraman R. Sridhar Iyer G. Sajith.
Advertisements

Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Testing Concurrent/Distributed Systems Review of Final CEN 5076 Class 14 – 12/05.
Parallel Programming Motivation and terminology – from ACM/IEEE 2013 curricula.
IPOG: A General Strategy for T-Way Software Testing
Abhinn Kothari, 2009CS10172 Parth Jaiswal 2009CS10205 Group: 3 Supervisor : Huzur Saran.
Combinatorial Testing Using Covering Arrays - Going Beyond Pairwise Testing Raghu Kacker, NIST Yu Lei, UTA 5/15/06.
Alternate Software Development Methodologies
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 20 Slide 1 Critical systems development.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
Software Model Checking for Embedded Systems PIs: Matthew Dwyer 1, John Hatcliff 1, and George Avrunin 2 Post-docs: Steven Seigel 2, Radu Iosif 1 Students:
Today’s Agenda  HW #1 Due  Quick Review  Finish Input Space Partitioning  Combinatorial Testing Software Testing and Maintenance 1.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Rick Kuhn Computer Security Division
1 Software Testing and Quality Assurance Lecture 15 - Planning for Testing (Chapter 3, A Practical Guide to Testing Object- Oriented Software)
Design of Fault Tolerant Data Flow in Ptolemy II Mark McKelvin EE290 N, Fall 2004 Final Project.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
System-Level Types for Component-Based Design Paper by: Edward A. Lee and Yuhong Xiong Presentation by: Dan Patterson.
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
Formal Techniques for Verification Using SystemC By Nasir Mahmood.
Formal Methods 1. Software Engineering and Formal Methods  Every software engineering methodology is based on a recommended development process  proceeding.
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
System/Software Testing
Timing and Race Condition Verification of Real-time Systems Yann–Hang Lee, Gerald Gannod, and Karam Chatha Dept. of Computer Science and Eng. Arizona State.
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.
4/2/03I-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Software Architecture and Design Readings: Ambler, Chap. 7 (Sections to start.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Scientific Computing By: Fatima Hallak To: Dr. Guy Tel-Zur.
Concurrency, Mutual Exclusion and Synchronization.
Software Engineering Research paper presentation Ali Ahmad Formal Approaches to Software Testing Hierarchal GUI Test Case Generation Using Automated Planning.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
CSE 219 Computer Science III Program Design Principles.
WXGE6103 Software Engineering Process and Practice Formal Specification.
Today’s Agenda  HW #1  Finish Introduction  Input Space Partitioning Software Testing and Maintenance 1.
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Chapter 8 Lecture 1 Software Testing. Program testing Testing is intended to show that a program does what it is intended to do and to discover program.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
Software Quality Assurance and Testing Fazal Rehman Shamil.
Comunication&Synchronization threads 1 Programación Concurrente Benemérita Universidad Autónoma de Puebla Facultad de Ciencias de la Computación Comunicación.
 Simulation enables the study of complex system.  Simulation is a good approach when analytic study of a system is not possible or very complex.  Informational,
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
Agenda  Quick Review  Finish Introduction  Java Threads.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
A PRELIMINARY EMPIRICAL ASSESSMENT OF SIMILARITY FOR COMBINATORIAL INTERACTION TESTING OF SOFTWARE PRODUCT LINES Stefan Fischer Roberto E. Lopez-Herrejon.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Chapter 8 – Software Testing
Definitions Concurrent program – Program that executes multiple instructions at the same time. Process – An executing program (the running JVM for Java.
Gabor Madl Ph.D. Candidate, UC Irvine Advisor: Nikil Dutt
Monitors Chapter 7.
IPOG: A General Strategy for T-Way Software Testing
Reachability testing for concurrent programs
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Monitors Chapter 7.
Concurrency: Mutual Exclusion and Process Synchronization
Monitors Chapter 7.
IPOG: A general strategy for t-way software testing by Lei, Yu, IEEE /2/2019 Mehra N Borazjany.
Chapter 7 Software Testing.
From Use Cases to Implementation
Presentation transcript:

Efficient Techniques for Software Testing Jeff Lei April 13, 2007

Outline Software Testing Concurrency Testing –Testing Concurrent Programs –Testing Synchronization Components T-Way Interaction Testing Other Work –Model Checking, Protocol Validation, Pervasive Computing

Software Engineering Software has become pervasive in modern society –Directly contributes to quality of life –Malfunctions cost billions of dollars every year, and have severe consequences in a safe-critical environment All about building better software in better ways, especially for large-scale development –Requirements, design, coding, testing, maintenance, configuration, documentation, deployment, and etc.

Software Testing A dynamic approach to detecting software faults –Alternatively, static analysis can be performed, which is however often intractable Involves sampling the input space, running the test object, and observing the runtime behavior Perhaps the most widely used approach in practice –Labor intensive, and often consumes more than 50% of development cost

Research Problems How to detect as many faults as possible spend with as little effort as possible? –How to generate a good set of test inputs? –How to perform actual test executions? –How to evaluate test outcomes?

Outline Software Testing Concurrency Testing –Testing Concurrent Programs –Testing Synchronization Components T-Way Interaction Testing Other Work –Model Checking, Protocol Validation

Concurrent Programs Consists of multiple threads of execution that proceed in parallel –multithreaded programs, multi-process (or distributed) programs Advantages: –Better resource utilization, increased computation efficiency, and providing simplified solutions for many problem domains Notoriously difficult to test due to their non- deterministic behavior

What Is Unique Non-determinism –Multiple executions with the same data input might display different behaviors Synchronization –How to ensure that concurrent events are exercised in an expected order? Communication –How to exchange information between different threads?

Concurrency Testing Strategies Non-deterministic testing - execute the same program with the same input for multiple times: –easy, but inefficient, and some errors cannot be detected Deterministic testing - select a set of test sequences and then force them to be exercised: –can detect more subtle errors, but requires additional effort for test sequence selection and runtime control State exploration – explore the state space in a systematic manner –suffers the well-known state explosion problem –state representation is difficult for programs written in a full- fledged programming language

Reachability Testing Combines non-deterministic and deterministic testing –Generating test sequences dynamically, without constructing any static model –Dealing with partial orders directly, and thus no redundant interleavings! Can also be considered as a state exploration technique –Exercising every possible synchronization sequence of a program with a given input

The Framework 1.Execute a program P with a given input non- deterministically to collect a trace Q 2.Identify the race conditions in Q and compute its race variants 3.For each variant, conduct a prefix-based test run to collect a new trace Q’ 4.Repeat 2, 3, and 4 for each newly collected trace Q’.

Example

Main Results Developed three reachability testing algorithms –Exhaustive RT, Combinatorial RT, and Random RT Built a reachability testing tool called RichTest –Portable implementation, applicable to most common synchronization constructs Conducted an empirical evaluation –Performed significantly better than VeriSoft (from Bell Labs) Publications: STVR07a, TSE06, ISSRE05

Dinning Philosophers

Outline Software Testing Concurrency Testing –Testing Concurrent Programs –Testing Synchronization Components T-Way Interaction Testing Other Work –Model Checking, Protocol Validation

Synchronization Components Synchronization logic is often encapsulated into one or more components Synchronization components need to be tested separately –Obtain necessary confidence prior to integration –helps to reduce complexity by incremental testing A different problem than testing complete programs –The ways in which a component could be used is typically unknown

Java Monitor A high-level synchronization construct that supports data encapsulation and information hiding –A Java class that defines one or more synchronized methods Mutual exclusion automatically enforced by the Java runtime Conditional synchronization implemented by the programmer, using wait and notify operations

Java Monitor Semantics Consists of three components: an entry queue, a critical section, a waiting queue A thread must enter the CS before it executes a synchronized method; it has to wait in the entry queue if the CS is not empty The wait and notify operations can only be executed inside the CS –wait: puts the current thread in the waiting queue –notify: awakens one thread in the waiting queue

Example class BoundedBuffer { private int fullSlots=0; private int capacity = 0; private int[] buffer = null; private int in = 0, out = 0; public BoundedBuffer(int bufferCapacity) { 1. capacity = bufferCapacity; 2. buffer = new int[capacity]; } public synchronized void deposit (int value) { 3. while (fullSlots == capacity) { 4. try { wait(); } catch (InterruptedException ex) {} } 5. buffer[in] = value; 6. in = (in + 1) % capacity; 7. if (fullSlots++ == 0) { 8. notifyAll(); } public synchronized int withdraw () { 9. int value = 0; 10. while (fullSlots == 0) { 11. try { wait(); } catch (InterruptedException ex) {} } 12. value = buffer[out]; 13. out = (out + 1) % capacity; 14. if (fullSlots-- == capacity) { 15. notifyAll(); } 16. return value; }

Graphic View Critical Section Entry Queue W Condition Queue D Assume that the buffer is initially empty.

Research Questions What is unique to testing Java monitors? –Used to synchronize, and thus typically accessed by, multiple threads simultaneously Can existing work on OO testing apply? –OO testing methods typically assume a single- threaded test driver How to effectively test Java monitors?

Technical Challenges To simulate possible scenarios in which a Java monitor can be accessed, multiple threads need to be created –Some faults can only be detected by a certain minimum number of threads. But how many? –Multiple threads can display non-deterministic behavior. How to describe and control thread behavior?

A State Exploration-Based Approach Explores the state space of a monitor as an open system –Threads introduced on-the-fly, and as needed, to simulate race conditions –State abstraction used to ensure termination and to control state explosion –Thread behavior is controlled at finer granularity than method calls

Main Results Developed an algorithm that implements the state exploration-based approach Built a prototype tool, called MonitorExplorer, and conducted an empirical evaluation –Empirical results suggest that this approach can be very effective Ongoing work: Extend to general monitors, and general synchronization components Publication: ISSRE06

Outline Software Testing Concurrency Testing –Testing Concurrent Programs –Testing Synchronization Components T-Way Interaction Testing Other Work –Model Checking, Protocol Validation, Pervasive Computing

Combinatorial Testing Creates tests by combining different parameter values –The input space of a test object is represented as a set of parameters and their values Advantages: light specification, test input generation can be fully automated, requires no access to source code How to deal with the combinatorial explosion problem?

T-Way Interaction Testing Motivation: Not every parameter contributes to every fault –Many faults can be exposed by interactions involving a few parameters Given any t parameters, every combination of values of these parameters be covered by at least one test –Allows faults triggered by at most t parameters to be detected Makes an excellent trade-off between test effort and test coverage

T-Way Testing - Example P1 P2 P P1 P2 P Three parameters, each with values 0 and 1 2-way testing exhaustive testing

State of the Art Greedy construction: Each step tries to cover as many combinations as possible –Involves explicit enumeration of all possible combinations Algebraic Construction: test sets are constructed using pre-defined rules Most approaches focus on 2-way (or pairwise) testing

Strategy In-Parameter-Order Input: A set of parameters and values; Output: a t-way test set Construct a t-way test set for the first t parameters Extend the test set to cover each of the remaining parameters one by one –Horizontal growth - extends each existing test by adding one value for the new parameter –Vertical growth – adds new tests, if needed, to make the test set complete

Example (a) P1 P2 P (b) P1 P2 P3 P P1 P2 P3 P * * (c) Horizontal growthVertical growth Four parameters: P1, P2, P3, and P4 P1, P2, and P3 have 2 values P4 has 3 values 3-way test set

Main Results Developed two algorithms, IPOG and IPOG- D, for general t-way testing –Has the lowest algorithmic complexity among the existing algorithms Built a t-way testing tool called FireEye, and conducted an empirical evaluation –Performed significantly better than existing tools, e.g., ITCH, TConfig, Jenny, TestVector Publications: TSE02, ECBS07, STVR07b

TCAS Example t- way FireEyeITCHJennyTConfigTVG SizeTimeSizeTimeSizeTimeSizeTimeSizeTime >1 hour >12 hour >21 hour NA>1 day NA>1 day NA>1 day NA>1 day TCAS: Seven 2-value parameters, two 3-value parameters, one 4-value parameter, two 10-value parameters

Outline Software Testing Concurrency Testing –Testing Concurrent Programs –Testing Synchronization Components T-Way Interaction Testing Other Work –Model Checking, Protocol Validation, Pervasive Computing

Other Work Model checking: How to deal with the state explosion problem? –True concurrency model vs interleaving-based concurrency model –Publication: FM05 Protocol validation: A more specific problem than model checking –Allows multiple threads to proceed simulatenously during state exploration –Publication: CJ06 Pervasive computing –Context-awareness: How to derive high level events from a sequence of low level events? –Power-constraints: How to reduce the power consumption on small mobile devices?

References [STVR07a] Y. Lei, R. Carver, R. Kacker, and D. Kung. A Combinatorial Testing Strategy for Concurrent Programs. Accepted for publication in Software Testing, Verification, and Reliability, [STVR07b] Y. Lei, R. Kacker, D. R. Kuhn, V. Okun, J. Lawrence. Two deterministic strategies for multi-way software testing. Software Testing, Verification, and Reliability, pending review. [ECBS07] Y. Lei, R. Kacker, D. R. Kuhn, V. Okun, J. Lawrence. A general strategy for multi- way software testing. Int’l Conf. on Engineering of Computer-Based Systems, [ISSRE06] Yu Lei, R. H. Carver, D. Kung, V. Gupta, M. Hernandez. A State Exploration- Based Approach to Testing Java Monitors. Int’l Symposium Software Reliability Engineering, , [CJ06] Q. Ye, Y. Lei, and D. Kung. A Blocking-Based Approach to Protocol Validation, The Computer Journal, 49: , [TSE06] Y. Lei and R. Carver, Reachability testing of concurrent programs, IEEE Transactions On Software Engineering, 32(6): , [FM05] Y. Lei and P. Iyer. An Approach to Unfolding Asynchronous Communication Protocols, Proc. 13th Intl. Symp. on Formal Methods, pp , [TSE02] K. C. Tai and Y. Lei, "A test generation strategy for pairwise testing", IEEE Transactions on Software Engineering, Vol. 28, No. 1, pp , Jan