Domain Testing Based on Character String Predicate Ruilian Zhao Computer Science Dept. Beijing University of Chemical Technology Michael R. Lyu Computer.

Slides:



Advertisements
Similar presentations
Analyzing Regression Test Selection Techniques
Advertisements

Automatic Test Data Generation of Character String Zhao Ruilian.
DATAFLOW TESTING DONE BY A.PRIYA, 08CSEE17, II- M.s.c [C.S].
A number of MATLAB statements that allow us to control the order in which statements are executed in a program. There are two broad categories of control.
Introduction to Computer Science 2 Lecture 7: Extended binary trees
Longest Common Subsequence
Software Testing and QA Theory and Practice (Chapter 6: Domain Testing) © Naik & Tripathy 1 Domain Testing Some examples.
Introduction to Programming Lesson 1. Objectives Skills/ConceptsMTA Exam Objectives Understanding Computer Programming Understand computer storage and.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Content Based Image Clustering and Image Retrieval Using Multiple Instance Learning Using Multiple Instance Learning Xin Chen Advisor: Chengcui Zhang Department.
Branch and Bound Searching Strategies
Character String Predicate Based Automatic Software Test Data Generation Ruilian Zhao Computer Science Dept. Beijing University of Chemical Technology.
Shortest Path With Negative Weights s 3 t
Data Dependence Based Testability Transformation in Automated Test Generation Presented by: Qi Zhang.
ASC Program Example Part 3 of Associative Computing Examining the MST code in ASC Primer.
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
Data Flow Analysis Compiler Design Nov. 8, 2005.
Program Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 5 Data Flow Testing
Software Testing and QA Theory and Practice (Chapter 6: Domain Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
AN ITERATIVE METHOD FOR MODEL PARAMETER IDENTIFICATION 4. DIFFERENTIAL EQUATION MODELS E.Dimitrova, Chr. Boyadjiev E.Dimitrova, Chr. Boyadjiev BULGARIAN.
Domain testing Tor Stålhane. Domain testing revisited We have earlier looked at domain testing as a simple strategy for selecting test cases. We will.
Section 2: Finite Element Analysis Theory
Presented By Dr. Shazzad Hosain Asst. Prof., EECS, NSU
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
© SERG Dependable Software Systems (Mutation) Dependable Software Systems Topics in Mutation Testing and Program Perturbation Material drawn from [Offutt.
1 A Static Analysis Approach for Automatically Generating Test Cases for Web Applications Presented by: Beverly Leung Fahim Rahman.
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.1 Chapter 5 Loops.
White Box-based Coverage Testing (© 2012 Professor W. Eric Wong, The University of Texas at Dallas) 111 W. Eric Wong Department of Computer Science The.
Chapter 7 Selection Dept of Computer Engineering Khon Kaen University.
Flows in Planar Graphs Hadi Mahzarnia. Outline O Introduction O Planar single commodity flow O Multicommodity flows for C 1 O Feasibility O Algorithm.
Copyright © Cengage Learning. All rights reserved.
1 8. One Function of Two Random Variables Given two random variables X and Y and a function g(x,y), we form a new random variable Z as Given the joint.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Timo O. Korhonen, HUT Communication Laboratory 1 Convolutional encoding u Convolutional codes are applied in applications that require good performance.
Foundation of Computing Systems
1 An Arc-Path Model for OSPF Weight Setting Problem Dr.Jeffery Kennington Anusha Madhavan.
© The McGraw-Hill Companies, Inc., Chapter 12 On-Line Algorithms.
Condition Testing. Condition testing is a test case design method that exercises the logical conditions contained in a program module. A simple condition.
1 Software Testing and Quality Assurance Theory and Practice Chapter 6 Domain Testing.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
MMM2005The Chinese University of Hong Kong MMM2005 The Chinese University of Hong Kong 1 Video Summarization Using Mutual Reinforcement Principle and Shot.
1 © 2011 Professor W. Eric Wong, The University of Texas at Dallas Requirements-based Test Generation for Functional Testing W. Eric Wong Department of.
11 -1 Chapter 12 On-Line Algorithms On-Line Algorithms On-line algorithms are used to solve on-line problems. The disk scheduling problem The requests.
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.
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
CS223: Software Engineering Lecture 26: Software Testing.
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
CS223: Software Engineering
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Condition Testing.
Lecture 2 Introduction to Programming
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 6 Domain Testing
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Structural testing, Path Testing
A Survey of Program Slicing Techniques: Section 4
Algorithm Discovery and Design
Institute of Computing Tech.
Introduction to Programming
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

Domain Testing Based on Character String Predicate Ruilian Zhao Computer Science Dept. Beijing University of Chemical Technology Michael R. Lyu Computer Science Dept. Chinese University of Hong Kong Yinghua Min Institute of Computing Tech. Chinese Academy of Sciences in Beijing

Outline Introduction Domain testing strategies Dynamic test data generation Domain testing based on character string predicate A case study Conclusion

Introduction Domain testing is a well-known testing technique, which attempts to reveal errors in the predicates by selecting test points on and near the boundary of a path domain. All these domain testing strategies suffer from a common weakness: character string predicates are not taken into account. Several research activities have been initiated in domain testing.

Introduction We present a novel approach to automatically generate ON-OFF test points for character string predicate borders associated with a program path. A corresponding test data generator is developed.

Introduction Each element of variables in a character string predicate is determined in turn by performing function minimization so that the ON-OFF test points for the corresponding predicate border are automatically generated. The preliminary experimental results show that this approach is effective and promising.

Domain testing strategies Domain testing strategies A domain error occurs when a specific input traverses a wrong path because of faults in the control flows of the program. Which can be manifested by a shift in some segment (border) of the path domain boundary. To detect domain errors or provide confidence in the correctness of path domain, Jeng and Weyuker presented a simplified domain testing strategy..

Domain testing strategies Domain testing strategies The simplified domain testing strategy requests to generate one ON and one OFF test points for an inequality border associated with operator ,. For an equality or non-equality border associated with operator = or , one ON test point and two OFF test points are required. ON test point lies on the border, OFF test point is placed slightly off the border on the outside, and the ON-OFF point pair has to be as close as possible.

Dynamic test data generation is a popular approach for developing test data. During dynamic test data generation, if some desired test requirement is not reached, data generated in each test execution is used to identify how close the test input is in meeting the requirement. With the help of feedback, test inputs are gradually modified until one of them satisfies the requirement.

Dynamic test data generation Dynamic test data generation In our research, dynamic test data generation is employed to derive ON-OFF test points for character string predicate borders associated with a program path.

Domain testing based on character string predicate Each character string predicate determines a border. A character string predicate is of the following form strcmp(str 1, str 2 ) op 0 where str 1 and str 2 are character strings constants or character string variables, and op  {,} 1. Character string predicate and predicate slice

Domain testing based on character string predicate As a result, we need to construct a branch function with respect to a predicate on a program path, and then evaluate the branch function value. 1. Character string predicate and predicate slice The problem of dynamic test data generation can be formulated to a function minimization problem The values of variables in the predicate must be calculated for program inputs.

Domain testing based on character string predicate A predicate slice of program P based on slicing criterion C=(x,y q ) is a syntactically correct and executable program that is obtained from P by deleting zero or more statements and adding the statements that return the values of the variables in the predicate. 1. Character string predicate and predicate slice We construct a slice with respect to a predicate to calculate the current values of the variables in the predicate. x is a program input, q denotes the node associated with a predicate, and y be a variable in the predicate.

Domain testing based on character string predicate The slice preserves the values of the variables in the predicate on program inputs. 1. Character string predicate and predicate slice The predicate slice produces an execution trace  x on input x for which there exists a corresponding execution position q such that the value of variable y at q on trace  x is equal to that of y at q on  x

Domain testing based on character string predicate 2. ON-OFF test point generation in character string domain The test generation problem can be stated as follows: “ Given a character string predicate border associated with a path, the goal is to find a program input pair so that one lies on the given border whereas the other is placed outside this border, and the pair has to be as close as possible. ” A problem that we must solve first is how to compare two character strings as well as how to evaluate a branch function with respect to a character string predicate.

ON-OFF test point generation in character string domain 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. It is easy to see that a character string can be transformed into a unique nonnegative integer.

ON-OFF test point generation in character string domain 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 ). By the distance between the i th characters of string str 1 and str 2 Without loss of generality, let L=L 2, str 1 [k]=‘0’ (k<L-1)

ON-OFF test point generation in character string domain We can construct a branch function  with respect to a character string predicate, e.g., strcmp(str 1,str 2 )>0, so that its value is positive for an initial input x 0. Namely, let  = dis(str 1,str 2 ). The distance dis(str 1,str 2 ) determines a nonnegative integer, and can be used to evaluate the branch function with regard to a character string predicate.

ON-OFF test point generation in character string domain Since every character element of a string is expressed by its ASCII code, we can construct the branch functions for every character. i.e., let  i =  str 1 [i]-str 2 [i]  so that  i > 0 (i=0,1, … L-1). An appropriate adjustment direction is searched for the i th character of an input variable, so that  i can be improved.

ON-OFF test point generation in character string domain As a result, we obtain two distinct characters that one satisfies  i  0 whereas the other meets  i >0. Each  i can reach its minimum by using gradient descent to perform function minimization. The two characters are refined gradually until the distance between them becomes the shortest.

ON-OFF test point generation in character string domain As each character is determined in turn, the branch function with respect to the predicate can become negative (or zero). Thus, we obtain two points that one satisfies  0 while the other meets  0. They can be selected as ON, OFF test points, respectively, depending on the operator op, and the distance between them is the shortest.

A case study We use an example to illustrate ON-OFF test point generation for a character string predicate border associated with a program path.

int max(int argc, char ** argv) 1 { argc--; 2 argv++; 3 if ((argc>0)&&('-'==**argv)) 4 { if (!strcmp(argv[0],"-ceiling")) 5 { strncpy(ceiling,argv[1],BUFSIZE); 6 argv++; argv++; 7 argc--; argc--; } else 8 { fprintf("Illegal option %s.\n",argv[0]); 9 return(0); }; } 10 if(argc==0) 11 { fprintf("At least requires one arguments.\n"); 12 return(0); } 13 for(;argc>0;argc--,argv++) 14 { if(strcmp(argv[0],result)>0); 15 strncpy(result,argv[0],BUFSIZE); } 16 if (strcmp(result, ceiling)>0) 17 printf("\n max:%s", result); 18 else printf("\n max:%s", ceiling); 19 return(1); } Fig.1 Program P Suppose program P is traversed along path on input x : argc=4, argv[1]= “ -ceiling ”, argv[2]= “ 193 ” and argv[3]= “ A2 ”. The predicate P6: strcmp(result, ceiling)>0) refers to a given character string predicate, and argv[3] is an adjusted input variable.

A case study The predicate slice with respect to x and  x, predicate_slice_p6, is produced by a pro-processor. By executing the predicate slice, we obtain the current value of variables result and ceiling in the predicate p6 on input x, that is, result = "A2", ceiling = "193".

According to the test generation algorithm, the ON-OFF test points for the predicate border are ON test point : argc=4, argv[1]= “ -ceiling ”, argv[2]= “ 193 ”, argv[3]= “ 192 ”. OFF test point : argc=4, argv[1]= “ -ceiling ”, argv[2]= “ 193 ”, argv[3]= “ 193 ”. It is clear that the distance between ON and OFF test point is shortest, only equaling to 1. A case study

Conclusion A predicate slice is constructed to calculate the current values of variables in the predicate, avoiding the problems found in symbolic execution and the cost of designing proper instrumentation. To our knowledge, this is the first approach to automatic test data generation based on character string predicates. The preliminary experimental results show that the methodology is promising and effective.