Feedback-Directed Random Test Generation Automatic Testing & Validation CSI5118 By Wan Bo.

Slides:



Advertisements
Similar presentations
Author: Carlos Pacheco, Shuvendu K. Lahiri, Michael D. Ernst, Thomas Ball MIT CSAIL.
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
Getting started with ML ML is a functional programming language. ML is statically typed: The types of literals, values, expressions and functions in a.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Lecture 2 Introduction to C Programming
Introduction to C Programming
Introduction to C Programming
Chapter 10.
CS 106 Introduction to Computer Science I 01 / 30 / 2008 Instructor: Michael Eckmann.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
© 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5/e Starting Out with C++: Early Objects 5 th Edition Chapter 2 Introduction.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Loops Repeat after me …. Loops A loop is a control structure in which a statement or set of statements execute repeatedly How many times the statements.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
C++ for Engineers and Scientists Third Edition
Introduction to C Programming
CSci 142 Data and Expressions. 2  Topics  Strings  Primitive data types  Using variables and constants  Expressions and operator precedence  Data.
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects Seventh.
Programming Languages and Paradigms Object-Oriented Programming.
Feed Back Directed Random Test Generation Carlos Pacheco1, Shuvendu K. Lahiri2, Michael D. Ernst1, and Thomas Ball2 1MIT CSAIL, 2Microsoft Research Presented.
10-Sep-15 Classes. Classes and objects Scala is an Object-Oriented (O-O), functional language Object-Oriented (O-O) means it’s built around “objects”
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 6: Exhaustive Bounded Testing and Feedback-Directed Random Testing.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Introduction to C Programming Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010 Fall.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
Loops (cont.). Loop Statements  while statement  do statement  for statement while ( condition ) statement; do { statement list; } while ( condition.
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Finding Errors in.NET with Feedback-Directed Random Testing Carlos Pacheco (MIT) Shuvendu Lahiri (Microsoft) Thomas Ball (Microsoft) July 22, 2008.
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
Chapter 3 Collections. Objectives  Define the concepts and terminology related to collections  Explore the basic structures of the Java Collections.
S Ramakrishnan1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University.
Automated Test Generation CS Outline Previously: Random testing (Fuzzing) – Security, mobile apps, concurrency Systematic testing: Korat – Linked.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
CS527 Topics in Software Engineering (Software Testing and Analysis) Darko Marinov September 7, 2010.
Intro-Sound-Mod10-part31 Introduction to Processing Digital Sounds part 3 while loop, tracing, for loop, parameters Barb Ericson Georgia Institute of Technology.
Random Test Generation of Unit Tests: Randoop Experience
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Unit 1 Review By: Mr. Jacobs.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
C++ for Engineers and Scientists Second Edition Chapter 4 Selection Structures.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
User-Written Functions
Types CSCE 314 Spring 2016.
Chapter 2: Introduction to C++
Chapter 2 - Introduction to C Programming
2.5 Another Java Application: Adding Integers
Multiple variables can be created in one declaration
Chapter 2 - Introduction to C Programming
Eclat: Automatic Generation and Classification of Test Inputs
Advanced Programming in Java
Introduction to Programming in Java
Outline Altering flow of control Boolean expressions
Introduction to C++ Programming
Advanced Programming Behnam Hatami Fall 2017.
Classes, Objects and Methods
CSE 1020:Software Development
Review for Midterm 3.
Presentation transcript:

Feedback-Directed Random Test Generation Automatic Testing & Validation CSI5118 By Wan Bo

Introduction

Random Testing VS System Testing – No certain conclusion which is better – Advantages of random testing for OO – Normal random test generation is unguided.

Purpose of this work: – random generation of unit tests for object- oriented programs. – a sequence of method calls for unit test. – random selecting or previous computed object as parameters for each method call.

Benefits of guided generation: – only sensible to build a legal sequence of method calls – Speed up generate process and reduce redundant sequences. – Example: Double a = sqrt(-1); Double b = log(a); With feedback, such call sequence will not be extended.

RANDOOP- random tester for object-oriented programs. – A software developed by this group – It can generate random test cases (more details later) – Example:

Methodology

Method Sequence – a method sequence, or simple sequence, is a sequence of method calls – Each call named S.i which means the value returned by the ith previous method call in sequence S

Extending Sequence – extension operation: takes zero or more sequences and produces a new sequence. – operator extend(m, seqs, vals) m: is a method with formal parameters of type T1; : : : ; Tk. seqs: is a list of sequences. vals: is a primitive values v1 : T1; : : : ; vk : Tk, or it is the return value s:i of the i-th method call for a sequence s appearing in seqs.

Example:

Feedback-directed Generation – build sequences incrementally – as soon as a sequence is built, execute to ensure non-redundant and legal objects (filters & contracts) – GenerateSequences(classes, contracts, filters, timeLimit) classes: a list of classes for which to create sequences contracts: a list of contracts filters: a list of filters timeLimit: a time limit to stop generation process

Generate Sequence – Step1 Create new Sequence – Step2 Discard duplication – Step3 Execute new sequence – Step4 Check contracts – Step 5 added in test sequence set.

Boolean vector – a boolean flag s:i.extensible. (whither it can be used as input in new method call) – Be used in filters (explain later) m(T1...Tk) at line 5 – Use reflection to load dll (being tested), store all method infos and classes infos into collection. Select randomly. – RandomMethodOrConstructorUniform(),return a reflecton.runtimemethodinfo

randomSeqsAndVals(T1...Tk) – Types is from methodinfo – The length of sequence is decided by limited time – When a new method call created, put in plan, when time out, write in cs file. Parameters – Primitive type, select a primitive value form fixed pool of values – Reference type Use one already exist in sequence (in plan). New one Null

Primitive Value Pool:

Extend Sequence The method is explained in previous slide Discard duplicates – Check whither equivalent sequence was already created in previous – Non error sequence set – Error sequence set Execute sequence – Execute calls in sequence one by one. And check contracts after each all. – If conflict with contract, set violated be true

Default Contracts

Filtering – setExtensibleFlags (newSeq; flters; ~o) line19 Function: determine which values of a sequence are extensible and should be used as inputs to new method calls – Equality. uses the equals() method to determine if the resulting object has been created before. – Null. set newSeq:i.extensible to false iff the corresponding object is null. Such as void method

– Exceptions. If exception occurs, even it does not conflict with contract, still set extendable false

Evaluation

Block Coverage

Block Coverage Running Time

Test common libs – REDUCE similar with Junit and Nunit – Used feedback-RANDOOP

Open Source: For Java: – For.Net: –

RUNDOOP2 for C# published 09/08/2010 Main structure:

Randoop – Load target dll by reflection, analysis and generate config file (xml) RandoopBare – According to config file, generate test cases. – Staticmanager calculates figures. – Generate log

Example 1 – Test target.Net System.Data.dll – Right now just can test dlls in C:\WINDOWS\Microsoft.NET\Framework\v – Randoop needs use csc.exe to compile test cases

Test Case:

My test cases: Lib- RandoopTestLib – Addition – Subtract – Arithmetic

Subtract

Put dll into C:\WINDOWS\Microsoft.NET\Framework\v For Int: For Long: For String and Object I can not find it.

The test case