Character String Predicate Based Automatic Software Test Data Generation Ruilian Zhao Computer Science Dept. Beijing University of Chemical Technology.

Slides:



Advertisements
Similar presentations
Automatic Test Data Generation of Character String Zhao Ruilian.
Advertisements

Xiutao Feng Institute of Software Chinese Academy of Sciences A Byte-Based Guess and Determine Attack on SOSEMANUK.
Technology of Test Case Generation Levi Lúcio University of Geneva Marko Samer Vienna University of Technology.
Da Yan, Zhou Zhao and Wilfred Ng The Hong Kong University of Science and Technology.
1/22 Programs : Semantics and Verification Charngki PSWLAB Programs: Semantics and Verification Mordechai Ben-Ari Mathematical Logic for Computer.
CS 106 Introduction to Computer Science I 11 / 09 / 2007 Instructor: Michael Eckmann.
Copyright © 2012 Pearson Education, Inc. Chapter 6 More Conditionals and Loops Java Software Solutions Foundations of Program Design Seventh Edition John.
Developing Pairwise Sequence Alignment Algorithms Dr. Nancy Warter-Perez.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
NORM BASED APPROACHES FOR AUTOMATIC TUNING OF MODEL BASED PREDICTIVE CONTROL Pastora Vega, Mario Francisco, Eladio Sanz University of Salamanca – Spain.
The Theory of NP-Completeness
Software Testing and Quality Assurance
Dynamically Discovering Likely Program Invariants to Support Program Evolution Michael Ernst, Jake Cockrell, William Griswold, David Notkin Presented by.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Data Dependence Based Testability Transformation in Automated Test Generation Presented by: Qi Zhang.
Domain Testing Based on Character String Predicate Ruilian Zhao Computer Science Dept. Beijing University of Chemical Technology Michael R. Lyu Computer.
ECE122 L8: More Conditional Statements February 7, 2007 ECE 122 Engineering Problem Solving with Java Lecture 8 More Conditional Statements.
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
Chapter 18 Testing Conventional Applications
Chapter 12 Pointers and linked structures. 2 Introduction  The data structures that expand or contract as required during the program execution is called.
Recursion In general there are two approaches to writing repetitive algorithms. One uses loops(while, do while and for): the other uses recursion. Recursion.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 9 Functional Testing
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
CREST Internal Yunho Kim Provable Software Laboratory CS Dept. KAIST.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Lecture 4 Sequences CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
DATA STRUCTURE & ALGORITHMS (BCS 1223) CHAPTER 8 : SEARCHING.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Flow of Control Part 1: Selection
Command Line Arguments plus Variable-Length Arrays Systems Programming.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2008 Algorithm analysis, searching and sorting  best vs. average vs. worst case analysis  big-Oh.
1 Building Java Programs Chapter 7: Arrays These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may not be rehosted, sold, or.
MINING COLOSSAL FREQUENT PATTERNS BY CORE PATTERN FUSION FEIDA ZHU, XIFENG YAN, JIAWEI HAN, PHILIP S. YU, HONG CHENG ICDE07 Advisor: Koh JiaLing Speaker:
Chapter 18: Searching and Sorting Algorithms. Objectives In this chapter, you will: Learn the various search algorithms Implement sequential and binary.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI C-Style Strings Strings and String Functions Dale Roberts, Lecturer.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Algorithm Analysis Chapter 5. Algorithm An algorithm is a clearly specified set of instructions which, when followed, solves a problem. –recipes –directions.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
© Love Ekenberg Hashing Love Ekenberg. © Love Ekenberg In General These slides provide an overview of different hashing techniques that are used to store.
1 An Arc-Path Model for OSPF Weight Setting Problem Dr.Jeffery Kennington Anusha Madhavan.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
1 Program Development  The creation of software involves four basic activities: establishing the requirements creating a design implementing the code.
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
Error Explanation with Distance Metrics Authors: Alex Groce, Sagar Chaki, Daniel Kroening, and Ofer Strichman International Journal on Software Tools for.
MMM2005The Chinese University of Hong Kong MMM2005 The Chinese University of Hong Kong 1 Video Summarization Using Mutual Reinforcement Principle and Shot.
Mutation Testing Breaking the application to test it.
HW7: Due Dec 5th 23:59 1.Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw.
Programming in Java (COP 2250) Lecture 12 & 13 Chengyong Yang Fall, 2005.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Loops ( while and for ) CSE 1310 – Introduction to Computers and Programming Alexandra Stefan 1.
Wishnu Prasetya Software Testing URL:
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Universal Turing Machine
The Methods and What You Need to Know for the AP Exam
Chapter 10 NP-Complete Problems.
Chapter 9: Value-Returning Functions
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Algorithm Discovery and Design
Institute of Computing Tech.
Introduction to Programming
HW#7 Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw the complete execution.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Character String Predicate Based Automatic Software Test Data Generation Ruilian Zhao Computer Science Dept. Beijing University of Chemical Technology Michael R. Lyu Computer Science Dept. Chinese University of Hong Kong

Outline Introduction An overview of related work Test data generation based on character string predicate Experimental results Conclusion

Introduction Software testing is usually difficult, expensive and time consuming. If test data could be automatically generated, the cost of software testing would be significantly reduced.

Introduction There are many automatic test data generation approaches. But, little attention has been paid to the problem of test data generation for programs whose predicates can contain character string variables.

Introduction Character string is an important element in programming. Here, we present an approach to automatically generate test data for program paths that include character string predicates, and a corresponding test data generator is developed. So,how to generate test data of character string is a problem that needs further research.

Introduction The effectiveness of test data generator is examined on a number of programs. The experimental results illustrate that the test data generator is effective.

An overview of related work 1. Predicate-based testing Predicate testing is a common approach to software testing, which requests each predicate in the program under test to be checked. There are a lot of predicate testing strategies. However, they demand that predicates in tested programs must be numerical predicates.

An overview of related work There are many automatic test data generation approaches. For example, Symbolic execution-based test data generation Random test data generation Dynamic test data generation 2. Test data generation

An overview of related work However, they do not generate test data of character string. Some systems are developed by using testing techniques to generate test data of integer, real or float types.

Test data generation based on character string predicate The goal of test data generation is to find a program input on which a chosen program path will be traversed. This problem can be reduced to a sequence of subgoals where each subgoal is solved by performing function minimization using gradient descent.

Test data generation based on character string predicate A character string predicate is the predicate that consists of at least one character string variable and one character string comparison function. We focus on how to automatically generate test data for program paths that include character string predicates.

Test data generation based on character string predicate Similarly to the numerical predicate, we can construct a branch function with regard to a character string predicate, which is not take the requirement branch, so that its value is positive for initial input x 0. For example, strcmp(str 1,str 2 ) > 0 Let  (x)=str 1 -str 2, if str 1 - str 2 is positive for initial input x 0, otherwise  (x)=str 2 -str 1. The current values of str 1 and str 2 in this predicate can be calculated by using program instrumentation technique.

Test data generation based on character string predicate The program input is adjusted gradually until  (x) becomes negative. A problem that we must resolve is how to compare two character strings as well as how to evaluate the branch function  (x). The required inputs have been found, namely, the predicate takes the requirement branch.

Test data generation based on character string predicate So, we first define a function ع where str is a character string, L is its length, is a positive weighting factor representing a weighted value imposed upon each character element of the string, and w is equal to 128.

Test data generation based on character string predicate By the theorem, a character string can be transformed into a unique nonnegative integer. Theorem: Suppose S is a set of character strings, is a set of nonnegative integers. Let is defined as above. Then is a one-to-one function from S to.

Test data generation based on character string predicate The distance between two strings can be defined as below: Where L 1 and L 2 are the length of string str1, str2, L=max(L 1,L 2 ). The distance dis(str 1,str 2 ) determines a nonnegative integer, and can be used to evaluate the branch function  (x) with regard to a character string predicate.

Test data generation based on character string predicate It is easy to see that by the verification of above theorem > We search an appropriate adjustment direction for the 0 th character of an input variable, and adjust the character by gradient descent until  0 <0. As a result, we can find an input that makes the string predicate to take the requirement branch.

Test data generation based on character string predicate For an equality (=) or non-equality (≠) predicate, we need to construct branch functions for every unequal character such that  i >0, where i  [0,L], L=max(L1,L2) Then, we search an adjustment direction to improve the branch function until  i  0.

Experimental results Int max(int argc,char ** argv) { argc--; argv++; if ((argc>0)&&('-'==**argv)) { if (!strcmp(argv[0],"-ceiling")) { strncpy(ceiling,argv[1],BUFSIZE); argv++; argv++; argc--; argc--; } else { fprintf(stderr,"Illegal option %s.\n",argv[0]); return(2); } if(argc==0) { fprintf(stderr,"Max requires at least one argument.\n"); return(2); } for(;argc>0;argc--,argv++) { if(strcmp(argv[0],result)>0); strncpy(result,argv[0],BUFSIZE); } if (strcmp(ceiling,result)<=0) printf("\n max:%s",ceiling); else printf("\n max:%s",result); return(0); } The specification: Which prints the lexicographic maximum of command-line arguments. There is one option:-ceiling This provides a ceiling: If the maximum would be larger than this specified ceiling, it is the maximum.

Experimental results Int max(int argc,char ** argv) { argc--; argv++; if ((argc>0)&&('-'==**argv)) { if (!strcmp(argv[0],"-ceiling")) { strncpy(ceiling,argv[1],BUFSIZE); argv++; argv++; argc--; argc--; } else { fprintf(stderr,"Illegal option %s.\n",argv[0]); return(2); } if(argc==0) { fprintf(stderr,"Max requires at least one argument.\n"); return(2); } for(;argc>0;argc--,argv++) { if(strcmp(argv[0],result)>0); strncpy(result,argv[0],BUFSIZE); } if (strcmp(ceiling,result)<=0) printf("\n max:%s",ceiling); else printf("\n max:%s",result); return(0); } record (argc,0,'>',"&&"); record('-',**argv, '='); if ((argc>0)&&('-'==**argv)) { record(argv[0],"-ceiling", '!'); if (!strcmp(argv[0],"-ceiling")) … ; } record(argc,0,'=',""); if(argc==0) … ; record(argc,0,'>',""); for(;argc>0;argc--,argv++) { record(argv[0],result, '>', ""); if (strcmp(argv[0],result)>0) … ; record(argc,0,'>',""); } record(ceiling,result, '-', ""); if (strcmp(ceiling,result)<=0) … ;

Experimental results Considering that the FOR loop is executed 0 time, 1 time and 2 times, there are 31 paths in Max program. We design 50 program inputs at random, which are used as the original input to the test data generator. As a result, 16 test inputs are generated by the test data generator.

Experimental results We measure the coverage of generated test data using the ATAC coverage testing tool.

Experimental results C ompare the evaluation number of branch function in the gradient descent, the gradual descent and the random-number test data generator under the same coverage. The gradient descent test data generator is more economical than the gradual descent and the random generator.

Conclusion To our knowledge, this is the first automatic test data generation approach based on character string predicates. The preliminary experimental results show that the methodology is effective.