Introduction to White-box Testing

Slides:



Advertisements
Similar presentations
Testing Coverage Test case
Advertisements

Florida International University COP 4770 Introduction of Weka.
Modeling and Simulation By Lecturer: Nada Ahmed. Introduction to simulation and Modeling.
Testing and Quality Assurance
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.
A Regression Test Selection Technique for Aspect- Oriented Programs Guoqing Xu The Ohio State University
1 Software Testing and Quality Assurance Lecture 9 - Software Testing Techniques.
Software Engineering Module 1 -Components Teaching unit 3 – Advanced development Ernesto Damiani University of Bozen- Bolzano Lesson 4 – Software Testing.
Parameterizing Random Test Data According to Equivalence Classes Chris Murphy, Gail Kaiser, Marta Arias Columbia University.
Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas.
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
Software Testing Prasad G.
Automated Diagnosis of Software Configuration Errors
What Exactly are the Techniques of Software Verification and Validation A Storehouse of Vast Knowledge on Software Testing.
OOSE 01/17 Institute of Computer Science and Information Engineering, National Cheng Kung University Member:Q 薛弘志 P 蔡文豪 F 周詩御.
Introduction to Systems Analysis and Design Trisha Cummings.
1. Topics to be discussed Introduction Objectives Testing Life Cycle Verification Vs Validation Testing Methodology Testing Levels 2.
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.
Exam 2 Terminology Review MIS Question 1 The second generation of the Web: A. Ecommerce B. Internet2 C. Web 2.0 D. All of the above.
Testing CSE 140 University of Washington 1. Testing Programming to analyze data is powerful It’s useless if the results are not correct Correctness is.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
The Daikon system for dynamic detection of likely invariants MIT Computer Science and Artificial Intelligence Lab. 16 January 2007 Presented by Chervet.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
Summarizing the Content of Large Traces to Facilitate the Understanding of the Behaviour of a Software System Abdelwahab Hamou-Lhadj Timothy Lethbridge.
Yazd University, Electrical and Computer Engineering Department Course Title: Advanced Software Engineering By: Mohammad Ali Zare Chahooki 1 Machine Learning.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
Stefan Mutter, Mark Hall, Eibe Frank University of Freiburg, Germany University of Waikato, New Zealand The 17th Australian Joint Conference on Artificial.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
1 Test Selection for Result Inspection via Mining Predicate Rules Wujie Zheng
(1) A beginners guide to testing Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University July 21, 2008WODA.
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.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
CISC Machine Learning for Solving Systems Problems Presented by: Suman Chander B Dept of Computer & Information Sciences University of Delaware Automatic.
Comparing model-based and dynamic event-extraction based GUI testing techniques : An empirical study Gigon Bae, Gregg Rothermel, Doo-Hwan Bae The Journal.
CSC 480 Software Engineering Testing - I. Plan project Integrate & test system Analyze requirements Design Maintain Test units Implement Software Engineering.
Software Engineering. Acknowledgement Charles Moen Sharon White Bun Yue.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Software Testing and Quality Assurance 1. What is the objectives of Software Testing?
Testing CSE 160 University of Washington 1. Testing Programming to analyze data is powerful It’s useless (or worse!) if the results are not correct Correctness.
Prof. Hany H. Ammar, CSEE, WVU, and
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
Software Quality Assurance and Testing Fazal Rehman Shamil.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Mutation Testing Breaking the application to test it.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Maikel Leemans Wil M.P. van der Aalst. Process Mining in Software Systems 2 System under Study (SUS) Functional perspective Focus: User requests Functional.
CS223: Software Engineering Lecture 26: Software Testing.
Test Case Purification for Improving Fault Localization presented by Taehoon Kwak SoftWare Testing & Verification Group Jifeng Xuan, Martin Monperrus [FSE’14]
Behavior Recognition Based on Machine Learning Algorithms for a Wireless Canine Machine Interface Students: Avichay Ben Naim Lucie Levy 14 May, 2014 Ort.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Introduction to OOAD and UML
Testing and Debugging UCT Department of Computer Science Computer Science 1015F Hussein Suleman March 2009.
10/23/ /23/2017 Presented at KDD’09 Classification of Software Behaviors for Failure Detection: A Discriminative Pattern Mining Approach David Lo1,
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
A Review of Software Testing - P. David Coward
Software Testing.
Introduction to Programming and Visual Basic
John D. McGregor Session 9 Testing Vocabulary
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Key Ideas from day 1 slides
runtime verification Brief Overview Grigore Rosu
John D. McGregor Session 9 Testing Vocabulary
John D. McGregor Session 9 Testing Vocabulary
Software testing strategies 2
Software Testing (Lecture 11-a)
Introduction to Systems Analysis and Design
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Mutation Testing The Mutants are Coming! Copyright © 2017 – Curt Hill.
Presentation transcript:

Introduction to White-box Testing Frank Xu, Ph.D. Department of Computer and Information Science Gannon University

Motivation Software problems and related faults: Airbus A380 (2006) Source: The top 10 IT disasters of all time: http://www.zdnet.com/article/the-top-10-it-disasters-of-all-time/ Software problems and related faults: Airbus A380 (2006) suffers from incompatible software issues At least two years behind schedule Ariane 5 rocket (1996) Data conversion (64-bit to 16-bit format) Cost $500M Therac 25 - Radiation therapy machine (1993) Overdosing patients during radiation Cost 6 lives

Testing One of the practical methods commonly used to detect the presence of errors (failures) in a computer program is to test it for a set of inputs. The output is correct? Our program I1, I2, I3, …, In, … Expected results = =? Actual results Black-box testing “Inputs” White-box testing

Exercise Implementing a method to solve Triangle problem

What is Triangle Problem?

How to test it? 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” ; } return “NotATriangle “;

Steps for White-box Testing assertEquals(“equalateral”, triangle.getTriangleType(7,7,7)) Step 1 Step 2 assertEquals(“Isosceles ”, triangle.getTriangleType(6,6,8)) ….. Source Code Control Flow Diagram Paths (based on coverage) Junit Test cases

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” ; if (condition) statement1; else statement2;

Control Flow Diagram

Branch Coverage Method Identify all the decisions Count all the branches from each of the decisions Pick the minimum number of paths that will cover all the branches from the decisions.

How many paths? For decision coverage McCabe’s Cyclomatic number # of binary decisions + 1 Input for path Equilateral: (7,7,7) assertEquals (“Equilateral”, triangle.getTriType(7,7,7))

Related to Cyber Security Include Software security Network security Data security Common approach for software security Testing for security E.g., testing for web security Test cases are needed for all testing

Auto-Generate Test Cases is Challenging Challenging 1:inputs generation Challenging 2: Oracle Problem assertEquals (“Equilateral”, triangle.getTriType(7,7,7)) ? assertEquals (“Isosceles ”, triangle.getTriType(6,6,8)) …..

Mining Decision Trees as Test Oracles for Java Bytecode Xu, W., Ding, T., Xu, D., Rule-based Test Input Generation From Bytecode, Proc. of the 8th International Conference on Software Security and Reliability, pp. 108-117, San Francisco, CA, June 2014. 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. 27-32, Kyoto, Japan, July 2013

Our Approach Rule-based search method to generate inputs Seed value adjust seed values based on rules (5,7,8) for Isosceles Adjust input values a==b (7,7,8) (5,5,8) Using heuristic model for test oracle A new data mining approach to build a heuristic behavioral model (in the form of decision tree)

Revisit: Triangle Problem

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

Jimple Java simpler version Simplify Statement Simplify condition Intermediate representation of bytecode Simplify Statement a <b+c (Java) [1] $d=b+c and [2] a <$d (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) … }}} www.sable.mcgill.ca/soot/

Training data Validation data Input Generator Input Generator (7,7,7) Path 1 [1]→[2]→[3]→[4]→[5] f >[6]→[7] f >[8]→[9] f >[10] f >[11] f >[12] 2 [1]→[2]→[3]→[4]→[5] f >[6]→[7] f >[8]→[9] f >[10] t >[13] f >[14] f >[15] t >[17] 3 ,,, .. 8 [1]→[2]→[3]→[4]→[5] f >[6]→[7] f >[8]→[9] f >[10] t >[13] f >[14] f >[15] f >[16] 9 [1]→[2]→[3]→[4]→[5] f >[6]→[7] f >[8]→[9] f >[10] f >[11] t >[13] f >[14] f >[15] f >[16] 10 [1]→[2]→[3]→[4]→[5] f >[6]→[7] f >[8]→[9] t >[18] 11 [1]→[2]→[3]→[4]→[5] f >[6]→[7] t >[18] 12 [1]→[2]→[3]→[4]→[5] t >[18] CFG Generator Path generator Input Generator Input Generator ID a b c 1 7 2 11 3 8 19 4 5 22 9 …   13 33 45 14 52 30 15 31 47 16 27 28 Validation data (7,7,7) Model miner Equilateral Training data

Input Generator

Path: [1]→[2]→[3]→[4]→[5] t >[18] Search an input that make predicate [5]:i0>=$i3 to true a>=b+c (NotATriangle)

Apply Rules to a Predicate Tree for Generating Test Inputs 10 4 7

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

Model Miner

Jimple Predicates and Attributes of Triangle Program Source Code i0 > = $i3 a > = b + c i1 > = $i4 b > = a + c i2 > = $i5 c > = a + b i0 != i1 a != b i1 != i2 b != c i0 == i1 a == b i0 == i2 a == c i1 == i2 b == c Input (a=7,b=7,c=7) f t For a given input, predicates produce a set of T or F values

Covert Inputs Using Attributes Test input ID a b c a>=b+c b>=a+c c>=a+b a!=b b!=c a==b a==c b==c Output 1 7 f t 2 11 3 4 8 19 …   13 33 45 14 52 30 15 31 47 16 27 28 22

The key idea of the algorithm is to Tool Test input ID a b c a>=b+c b>=a+c c>=a+b a!=b b!=c a==b a==c b==c Output 1 7 f t 2 11 3 4 8 19 …   13 33 45 14 52 30 15 31 47 16 27 28 22 C4.5 mining algorithm The key idea of the algorithm is to calculate the highest normalized information gain of attributes and then build a decision node that splits on the attributes Tool Weka 3: http://www.cs.waikato.ac.nz/ml/weka/

Empirical Study

Three Study Subjects Unit Under Testing Line of Code Number of Predicates   Java Jimple (Allow duplications) Attributes (No duplication) Triangle 22 27 3 8 Next Date 48 51 9 19 Vending Machine 82 68 21 41 10

Goal of Empirical Studies Measure fault detection capability # mutants killed /#mutants *100%

Measure fault detection capability: Process Mutation Operator Examples Category ID Type Original Replaced Arithmetic Operations 1 Arithmetic Operator Replacement a + b a - b 2 Arithmetic Operator Insertion b + c -b + c Relations 3 Relational Operator Replacement a != b a == b Conditions 4 Conditional Operator Replacement (a==b) && (b==c) (a==b) || (b==c) Constants 5 Constant Value Modification s = a s = b Return Values 6 Return Value Modification return s return s’ Step 1: Implant mutants Step 2: Build a decision tree model Step 3: Find mismatches Find possible causes Step 4: Calculate fault detectability Insert bug Create mutant and insert mutants Two possible causes Found bugs assertEquals(“Equilateral”, new Trianlge(7,7,7).getTriType()) Model is not correct assertEquals (“Isosceles”, new Trianlge(7,7,7).getTriType()) Faulty version Find mismatches

Results of fault detection evaluation Mutation ID # of Mutants # of Tests Executed Oracle Results # Mutants Discovered Faults in Models S D U Triangle 51 123 48 3 NextDate 54 94 95 109 15 16 18 2 Vending 45 465 Total 150 886 142 8 statement coverage (S), decision coverage (D), and un-reduced decision coverage (U),

Conclusions The first attempt to mine decision tree models from auto-generated test inputs based on static analysis of Java bytecode Our empirical study indicates that using the mined test oracles, average 94.67% mutants are killed by the generated test inputs. Future plan Empirical study

Thanks

Related Work Lo et al. (Lo, Cheng, Han, Khoo, & Sun, 2009), Milea et al. (Milea, Khoo, Lo, & Pop, 2012) mines a set of discriminative features capturing repetitive series of events from program execution traces. These features are then used to train a classier to detect failures. Bowring et al. (Bowring, Rehg, & Harrold, 2004) models program executions as Markov models, and a clustering method for Markov models that aggregates multiple program executions into effective behavior classifiers. (Pacheco & Ernst, 2005) Pacheco and Ernst build an operational model from observations of the software running properly. The operation model includes object invariants and properties. The object invariants are the conditions hold on entry and exit of all public methods. Our approach generates and classifies inputs based on the internal structure of the UUT. Briand (Briand, 2008) has proposed the use of machine learning techniques - including decision trees - for the test oracle problem. The decision tree model he has proposed is manually built from software requirements.

Future Research Direction 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

Test Oracle Overview

Control Flow Diagram

Build Variable Dependency Tree (VDT)

Bio – Frank Xu Education Working Experience Ph.D. in Software Engineering North Dakota State University M.S. in Computer Science Towson University B.S. in Computer Science Southeast Missouri State University Working Experience GE Transportation, 2008- present, Consultant of Locomotive Remote Diagnostics Service Center Gannon University, 2008- Present, Assistant/Associate Professor of Software Engineering, Director of Keystone Software Development Institute University VA –Wise, 2007- 2008, Assistant Professor of Software Engineering Swanson Health Products, 2005 ~ 2007, Sr. Programmer Analyst Volt Information Science Inc., 2004 ~ 2005, Software Engineer

Teaching Software engineer in UML Requirement engineering Software Design Software Quality Assurance Software Maintenance Object-Oriented Modeling Personal Software Process Advance Programming in Java Mobile Application Programming Multi-Tiered Systems Dynamic Web Programming Operating System Discrete Math

Source: Student Evaluation Report Teaching Evaluation Source: Student Evaluation Report

Research

Publications and Citations Year 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 Total Conference 3 2 1 4 24 Journal   8 5 6 32 Source: Google scholar: http://scholar.google.com/citations?user=9_I4ZUgAAAAJ&hl=en