Frank Xu, Ph.D. Gannon University Automated Test-Input Generation Xu, W., Ding, T., Wang, H., Xu. D., Mining Test Oracles for Test Inputs Generated from.

Slides:



Advertisements
Similar presentations
Introduction to White-box Testing
Advertisements

Introduction to Software Testing Chapter 3.3 Logic Coverage for Source Code Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.3 Logic Coverage from Source Code Paul Ammann & Jeff Offutt.
About Me – Frank Xu Education ▫ North Dakota State University  Ph.D. in Software Engineering ▫ Towson University  MS in Computer Science ▫ Southeast.
1 Program Slicing Purvi Patel. 2 Contents Introduction What is program slicing? Principle of dependences Variants of program slicing Slicing classifications.
Overview. What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. 2 STEP 1 STEP.
Introduction to Computers and Programming Lecture 11: Introduction to Methods Professor: Evan Korth New York University.
Introduction to Computers and Programming Introduction to Methods in Java.
 2007 Pearson Education, Inc. All rights reserved C Functions.
Chapter 1 Assuming the Role of the Systems Analyst
Copyright by Scott GrissomCh 1 Software Development Slide 1 Software Development The process of developing large software projects Different Approaches.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
 2003 Prentice Hall, Inc. All rights reserved Introduction Modules –Small pieces of a problem e.g., divide and conquer –Facilitate design, implementation,
Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program to be tested. The methodology.
1 Develop a large software with IBM Rational ® Software Engineering Semester Project Chih-Hong Jeng & Farn Wang fall 2006.
Com1040 Systems Design and Testing Part II – Testing (Based on A.J. Cowling’s lecture notes) LN-Test3: Equivalence classes and boundary conditions Marian.
Frank Xu, Ph.D. Gannon University Mining Decision Trees as Test Oracles for Java Bytecode Xu, W., Ding, T., Xu, D., Rule-based Test Input Generation From.
High-Level Programming Languages: C++
Software Testing (Part 2)
Chapter 11 Describing Process Specifications and Structured Decisions Systems Analysis and Design Kendall and Kendall Fifth Edition.
Graph Data Management Lab, School of Computer Science gdm.fudan.edu.cn XMLSnippet: A Coding Assistant for XML Configuration Snippet.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
1 PARSEWeb: A Programmer Assistant for Reusing Open Source Code on the Web Suresh Thummalapenta and Tao Xie Department of Computer Science North Carolina.
Introduction to Software Testing
1 A Static Analysis Approach for Automatically Generating Test Cases for Web Applications Presented by: Beverly Leung Fahim Rahman.
TRIGON BASED AUTHENTICATION, AUTHORIZATION AND DISTRIBUTION OF ENCRYPTED KEYS WITH GLOBUS MIDDLEWARE Anitha Kumari K 08MW01 II ME – Software Engineering.
CONVERTING TO CHOMSKY NORMAL FORM
1 testing17 Software Testing Functional, MCC, Dataflow Testing, Cause-Effect Graphing.
Software Testing. 2 CMSC 345, Version 4/12 Topics The testing process  unit testing  integration and system testing  acceptance testing Test case planning.
1 Introduction Modules  Most computer programs solve much larger problem than the examples in last sessions.  The problem is more manageable and easy.
Student Curriculum Planning System MSE Project Presentation I Kevin Sung.
1 Equivalence Class Testing Chapter 6. 2 Introduction Boundary Value Testing derives test cases with Massive redundancy Serious gaps Equivalence Class.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 6 September 17, 2009.
Summarizing “Structural” Testing Now that we have learned to create test cases through both: – a) Functional (blackbox)and – b) Structural (whitebox) testing.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Software Testing. Software testing is the execution of software with test data from the problem domain. Software testing is the execution of software.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Development of.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
EXAMPLE 1 Standardized Test Practice SOLUTION Let ( x 1, y 1 ) = ( –3, 5) and ( x 2, y 2 ) = ( 4, – 1 ). = (4 – (–3)) 2 + (– 1 – 5) 2 = = 85 (
Frank Xu, Ph.D. Gannon University Mining Decision Trees as Test Oracles for Java Bytecode Xu, W., Ding, T., Wang, H., Xu. D., Mining Test Oracles for Test.
Algorithms Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin,
Computer Science 112 Fundamentals of Programming II.
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 6 - Methods Outline 6.1 Introduction 6.2 Program Modules in Java 6.3 Math -Class Methods 6.4.
Introduction Modules Small pieces of a problem ▴ e.g., divide and conquer Facilitate design, implementation, operation and maintenance of large programs.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
Digitaalsüsteemide verifitseerimise kursus1 Exercises Binary decision diagrams ROBDD generation. Shannon expansion Finding an optimal ordering Dynamic.
1 Seattle University Master’s of Science in Business Analytics Key skills, learning outcomes, and a sample of jobs to apply for, or aim to qualify for,
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
CS223: Software Engineering Lecture 26: Software Testing.
Using Citation Analysis to Study Evaluation Influence: Strengths and Limitations of the Methodology Lija Greenseid, Ph.D. American Evaluation Association.
Course Code : 15ECSC204 Object Oriented Progamming.
Paul Ammann & Jeff Offutt
CSC 321: Data Structures Fall 2016
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
CSCI-235 Micro-Computer Applications
Key Ideas from day 1 slides
CSC 221: Computer Programming I Spring 2010
CSC 221: Computer Programming I Fall 2005
Moonzoo Kim CS Dept. KAIST
Moonzoo Kim CS Dept. KAIST
Chapter 9 Path Testing–Part 1
CSCE 747 Software Testing and Quality Assurance
Paul Ammann & Jeff Offutt
Logic Coverage from Source Code
Logic Coverage for Source Code CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Overview Functional Testing Boundary Value Testing (BVT)
Presentation transcript:

Frank Xu, Ph.D. Gannon University Automated Test-Input Generation Xu, W., Ding, T., Wang, H., Xu. D., Mining Test Oracles for Test Inputs Generated from Java Bytecode, Proc. of the 37th Annual International Computer Software & Applications Conference, pp , Kyoto, Japan, July 2013 Mining Decision Trees as Test Oracles for Java Bytecode (Extended version of conference paper), Accepted by Journal of Systems and Software

About Me – Frank Xu Education Ph.D. in Software Engineering, North Dakota State University M.S. in Computer Science, Towson University B.S. in Computer Science, Minor in Math, Southeast Missouri State University Working Experience GE Transportation, present, Consultant Gannon University, present, Assistant Professor of Software Engineering, Director of Keystone Software Development Institute University VA –Wise, , Assistant Professor of Software Engineering Swanson Health Products, 2005 ~ 2007, Sr. Web Programmer Analyst Volt Information Science Inc., 2004 ~ 2005, Software Engineer (Web)

Teaching Source: Student Evaluation Report

Research Source: Google scholar:

A UTOMATED T EST -I NPUT G ENERATION Introduction Software testing Test automation Test Inputs How to Generate Test Inputs Simplifying Java Code Applying rules Empirical Study/Demo Conclusions

I NTRODUCTION

Exercise Implementing a method to solve Triangle problem

What is Triangle Problem?

What is Method? Is a function or a service to complete a task A method that determines the maximum of two numbers. A method that sorts a list of names A method that opens a file from the file system Method Invoked by a method call Returns a result to calling method (caller) Similar to a boss (caller) asking a worker (called method) to complete a task

Method square returns int that result stores Method square returns the square of y y is the parameter of method square  2003 Prentice Hall, Inc.

How to test Triangle? String getTriangleType (int a, int b, int c){ if((a<b+c) && (b<a+c) && (c<a+b)){ if (a==b && b==c) return “Equilateral ”; else if (a!=b && a!=c &&b!=c) return “Scalene ”; else return “Isosceles” ; } else return “NotATriangle “; } String getTriangleType (int a, int b, int c){ if((a<b+c) && (b<a+c) && (c<a+b)){ if (a==b && b==c) return “Equilateral ”; else if (a!=b && a!=c &&b!=c) return “Scalene ”; else return “Isosceles” ; } else return “NotATriangle “; }

if... else Control Flow if (condition) statement1; else statement2; if (a==b && b==c) return “Equilateral ”; else if (a!=b && a!=c &&b!=c) return “Scalene ”; else return “Isosceles” ;

Control Flow Diagram

S UMMARY : T EST T RIANGLE S TEPS Source Code Control Flow Diagram Paths (based on coverage) assertEquals(“Isosceles ”, getTriangleType(7,7,9)) Junit Test cases assertEquals(“Isosceles ”, getTriangleType(6,6,8)) ….. Step 1 Step 2 Step 3

H OW TO A UTO -G ENERATE T ESTING I NPUTS ? assertEquals (“Isosceles ”, getTriangleType(7,7,9) assertEquals (“Isosceles ”, getTriangleType(6,6,8) ….. ?

S OLUTION Randomly generate inputs (5,7,6) for Isosceles Adjust input values a=5, b=7, a==b

R EVISIT : T RIANGLE P ROBLEM

Java is Complex Statement contains comparison and expression a <b+c (Java) Condition (a<b+c) && (b<a+c) && (c<a+b)

J AVA S IMPLER V ERSION Simplify Statement a <b+c (Java) [1] $i3=i1+i2 and [2] i0>=$i3 (Jimple) Simplify condition (a<b+c) && (b<a+c) && (c<a+b) (Java) Jimple if (a<b+c) { if (b<a+c) { if(c<a+b) … }}}

IDPath 1 2 3,,,..,,, IDabc ………… … Generate inputs Path generation Generate CFG

H OW TO G ENERATE T EST I NPUTS IDabc … ………… … IDPath 1 2 3,,,

Search an input that make predicate [5]:i0>=$i3 to true a>=b+c (NotATriangle) Challenge: backtracking $i3 to input variables Recall $i3=i1+i2 Solution:

Apply Rules for Generating Test Inputs

IDPredicateExpected Evaluation Outcomes Advising Rules 1. i0 > i1(i0 > i1) = true(i0 ↑, i1) (i0, i1 ↓ ) 1. (i0 > i1) = false(i0 ↓,b) (i0, i1 ↑ ) 1. i0 == i1(i0==i1) = true(i0 ↓ D, i1)( i0, i1 ↑ D) 1. (i0== i1)= false(i0 ↑,i1) (i0, i1 ↑ ) (i0 ↓,i1) (i0, i1 ↓ ) 1. i2 = i0 + i1i2 ↑ (i0 ↑, i1) (i0, i1 ↑ ) 1. i2 ↓ (i0 ↓, i1) (i0, i1 ↓ ) 1. i2 = i0 - i1i2 ↑ (i0 ↑, i1) (i0, i1 ↓ ) 1. i2 ↓ (i0 ↓, i1)( i0, i1 ↑ ) 1. i2 = i0 * i1 (i0>0, i1>0) i2 ↑ (i0 ↑, i1) (i0, i1 ↑ ) 1. i2 ↓ (i0 ↓, i1) (i0, i1 ↓ ) 1. i2 = i0 / i1 (i0>0, i0 > 0) i2 ↑ (i0 ↑, i1) (i0, i1 ↓ ) 1. i2 ↓ (i0- ↓ i1)( i0, i1 ↑ ).. 1. s0>s1(s0 >s1) = true(s0[k] ↑, s1) (s0, s1[l] ↓ ) 1. (s0 > s1) = false(s0[k] ↓,s2) (s0, s1[l] ↑ )

E MPIRICAL S TUDY

T HREE S TUDY S UBJECTS Line of CodeNumber of Predicates JavaJimpleJava Jimple (Allow duplications) Attributes (No duplication) Triangle Next Date Vending Machine

G OAL OF E MPIRICAL S TUDIES What is the performance of the proposed approach?

IDGoalExecution Time to Generate 100 Inputs (ms) Triangle 1 Equilateral255 2 Isosceles167 3 Scalene146 4 NotATriangle121 Next Date 1 Normal day && 1st month 96 2 Last day && 1st month Normal day Last day of a normal month Normal day in Dec Last day of a year Normal day in Feb leap year Non- leap year Incorrect days of a leap year 912 Vending Machine (Change, Dollar, Cents, Juice, Beer) 1(1,1,0,0.1)534 2(1,1,0,0,0)553 3(1,0,1,1,0)523 4(1,0,1,0,1)495 5(0,1,0,1,0)277 6(0,1,0,0,0)339 7(0,0,1,1,1)285 8(0,0,1,0,1)310

Demo Path 1: Equilateral Path 5, 7, 8: Isosceles Path 6: Scalene Path 10, 11, 12: not a triangle

Key Points Understand requirements before implementation Test your code Auto test your code if possible Auto generate test inputs

Thanks

Future Research Directions Requirements Engineering & Natural language Process Generating UML diagrams, e.g., Use case, Class diagram Validating SRS Deriving test cases from SRS Software Design & Social Networks Analysis Utilizing SSA for analyzing communication diagram, class diagram, and sequence diagram for improving the quality of the software Software Implementation & Big Data Mining repository for software quality assurance using Hadoop Software Testing & Mobile/Cloud Application Testing mobile applications and distributed applications