Mining Gigabytes of Dynamic Traces for Test Generation Suresh Thummalapenta North Carolina State University Peli de Halleux and Nikolai Tillmann Microsoft.

Slides:



Advertisements
Similar presentations
Cristian Cadar, Peter Boonstoppel, Dawson Engler RWset: Attacking Path Explosion in Constraint-Based Test Generation TACAS 2008, Budapest, Hungary ETAPS.
Advertisements

Leonardo de Moura Microsoft Research. Z3 is a new solver developed at Microsoft Research. Development/Research driven by internal customers. Free for.
Tutorial Pex4Fun: Teaching and Learning Computer Science via Social Gaming Nikolai Tillmann, Jonathan de Halleux, Judith Bishop, Michal.
PLDI’2005Page 1June 2005 Example (C code) int double(int x) { return 2 * x; } void test_me(int x, int y) { int z = double(x); if (z==y) { if (y == x+10)
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Automatic test case generation for programs that are coded against interfaces and annotations or use native code Mainul Islam Supervisor: Dr. Christoph.
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
Symbolic execution © Marcelo d’Amorim 2010.
Automation of Test Case Generation
Hybrid Concolic Testing Rupak Majumdar Koushik Sen UC Los Angeles UC Berkeley.
CSE503: SOFTWARE ENGINEERING SYMBOLIC TESTING, AUTOMATED TEST GENERATION … AND MORE! David Notkin Spring 2011.
Pexxxx White Box Test Generation for
DART Directed Automated Random Testing Patrice Godefroid, Nils Klarlund, and Koushik Sen Syed Nabeel.
Program Exploration with Pex Nikolai Tillmann, Peli de Halleux Pex
Nikolaj Bjørner Leonardo de Moura Nikolai Tillmann Microsoft Research August 11’th 2008.
Chapter 2: Algorithm Discovery and Design
Analysis of Complex Data Structures with PEX Vadim Mutilin Evgeniy Gerlits Vladimir Fedotov Mentor: Patrice Godefroid.
Automating Software Testing Using Program Analysis -Patrice Godefroid, Peli de Halleux, Aditya V. Nori, Sriram K. Rajamani,Wolfram Schulte, and Nikolai.
Deep Dive into Pex How Pex works, implications for design of Code Hunt puzzles Nikolai Tillmann Principal Software Engineering Manager Microsoft, Redmond,
Rationale Aspiring Database Developers should be able to efficiently query and maintain databases. This module will help students learn the Structured.
Feed Back Directed Random Test Generation Carlos Pacheco1, Shuvendu K. Lahiri2, Michael D. Ernst1, and Thomas Ball2 1MIT CSAIL, 2Microsoft Research Presented.
Separation of Concerns Tao Xie Peking University, China North Carolina State University, USA In collaboration with Nikolai Tillmann, Peli de Halleux, Wolfram.
Tao Xie North Carolina State University Supported by CACC/NSA Related projects supported in part by ARO, NSF, SOSI.
Automated Testing of System Software (Virtual Machine Monitors) Tao Xie Department of Computer Science North Carolina State University
DART: Directed Automated Random Testing Koushik Sen University of Illinois Urbana-Champaign Joint work with Patrice Godefroid and Nils Klarlund.
Tao Xie (North Carolina State University) Nikolai Tillmann, Jonathan de Halleux, Wolfram Schulte (Microsoft Research, Redmond WA, USA)
CUTE: A Concolic Unit Testing Engine for C Technical Report Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
DySy: Dynamic Symbolic Execution for Invariant Inference.
Tao Xie Automated Software Engineering Group Department of Computer Science North Carolina State University
Teaching and Learning Programming and Software Engineering via Interactive Gaming Tao Xie University of Illinois at Urbana-Champaign In collaboration with.
Automated Whitebox Fuzz Testing (NDSS 2008) Presented by: Edmund Warner University of Central Florida April 7, 2011 David Molnar UC Berkeley
Automated Whitebox Fuzz Testing Network and Distributed System Security (NDSS) 2008 by Patrice Godefroid, ‏Michael Y. Levin, and ‏David Molnar Present.
Tao Xie North Carolina State University Nikolai Tillmann, Peli de Halleux, Wolfram Schulte Microsoft Research.
Code Contracts Parameterized Unit Tests Tao Xie. Example Unit Test Case = ? Outputs Expected Outputs Program + Test inputs Test Oracles 2 void addTest()
1.  Writing snippets of code that try to use methods (functions) from your program.  Each snippet should test one (and only one) function......by calling.
Code Hunt: Experience with Coding Contests at Scale Judith Bishop, R Nigel Horspool, Tao Xie, Nikolai Tillmann, Jonathan de Halleux Microsoft Research,
Computer Science Automated Software Engineering Research ( Mining Exception-Handling Rules as Conditional Association.
Alattin: Mining Alternative Patterns for Detecting Neglected Conditions Suresh Thummalapenta and Tao Xie Department of Computer Science North Carolina.
Nikolai Tillmann, Jonathan de Halleux Tao Xie Microsoft Research Univ. Illinois at Urbana-Champaign.
Automated Patch Generation Adapted from Tevfik Bultan’s Lecture.
Xusheng Xiao North Carolina State University CSC 720 Project Presentation 1.
Exploiting Code Search Engines to Improve Programmer Productivity and Quality Suresh Thummalapenta Advisor: Dr. Tao Xie Department of Computer Science.
jFuzz – Java based Whitebox Fuzzing
Finding Errors in.NET with Feedback-Directed Random Testing Carlos Pacheco (MIT) Shuvendu Lahiri (Microsoft) Thomas Ball (Microsoft) July 22, 2008.
Directed Random Testing Evaluation. FDRT evaluation: high-level – Evaluate coverage and error-detection ability large, real, and stable libraries tot.
Cooperative Developer Testing: Tao Xie North Carolina State University In collaboration with Xusheng ASE and Nikolai Tillmann, Peli de
Search Worms, ACM Workshop on Recurring Malcode (WORM) 2006 N Provos, J McClain, K Wang Dhruv Sharma
Testing Cross-Platform Mobile App Development Frameworks Nader Boushehrinejadmoradi, Vinod Ganapathy, Santosh Nagarakatte, Liviu Iftode Department of Computer.
A Test Case + Mock Class Generator for Coding Against Interfaces Mainul Islam, Christoph Csallner Software Engineering Research Center (SERC) Computer.
Parameterized Unit Testing in the Open Source Wild Wing Lam (U. Illinois) In collaboration with Siwakorn Srisakaokul, Blake Bassett, Peyman Mahdian and.
1 Exposing Behavioral Differences in Cross-Language API Mapping Relations Hao Zhong Suresh Thummalapenta Tao Xie Institute of Software, CAS, China IBM.
Improving Structural Testing of Object-Oriented Programs via Integrating Evolutionary Testing and Symbolic Execution Kobi Inkumsah Tao Xie Dept. of Computer.
CUTE: A Concolic Unit Testing Engine for C Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
Random Test Generation of Unit Tests: Randoop Experience
Symbolic Execution in Software Engineering By Xusheng Xiao Xi Ge Dayoung Lee Towards Partial fulfillment for Course 707.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION SYMBOLIC TESTING Autumn 2011.
Symstra: A Framework for Generating Object-Oriented Unit Tests using Symbolic Execution Tao Xie, Darko Marinov, Wolfram Schulte, and David Notkin University.
Finding bugs with a constraint solver daniel jackson. mandana vaziri mit laboratory for computer science issta 2000.
Resource Optimization for Publisher/Subscriber-based Avionics Systems Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee.
Clear Lines Consulting · clear-lines.comApril 21, 2010 · 1 The Joy of Pex
Dynamic Symbolic Execution
High Performance Computing on an IBM Cell Processor --- Bioinformatics
A Test Case + Mock Class Generator for Coding Against Interfaces
Presented by Mahadevan Vasudevan + Microsoft , *UC-Berkeley
Marcelo d’Amorim (UIUC)
White-Box Testing Using Pex
Objectives At the end of the class, students are expected to be able to do the following: Understand the purpose of sorting technique as operations on.
CUTE: A Concolic Unit Testing Engine for C
CSE 1020:Software Development
Presentation transcript:

Mining Gigabytes of Dynamic Traces for Test Generation Suresh Thummalapenta North Carolina State University Peli de Halleux and Nikolai Tillmann Microsoft Research Scott Wadsworth Microsoft

2 A unit test is a small program with test inputs and test assertions void AddTest() { HashSet set = new HashSet(); set.Add(7); set.Add(3); Assert.IsTrue(set.Count == 2); } Many developers write unit tests by hand Test Scenario Test Assertions Test Data

void AddSpec(int x, int y) { HashSet set = new HashSet(); set.Add(x); set.Add(y); Assert.AreEqual(x == y, set.Count == 1); Assert.AreEqual(x != y, set.Count == 2); } Parameterized Unit Tests separate two concerns: 1) The specification of externally visible behavior(assertions) 2) The selection of internally relevant test inputs(coverage) Use dynamic symbolic execution to generate unit tests

Code to generate inputs for: Constraints to solve a!=null a!=null && a.Length>0 a!=null && a.Length>0 && a[0]== void CoverMe(int[] a) { if (a == null) return; if (a.Length > 0) if (a[0] == ) throw new Exception("bug"); } Observed constraints a==null a!=null && !(a.Length>0) a==null && a.Length>0 && a[0]!= a==null && a.Length>0 && a[0]== Input null {} {0} {123…} a==null a.Length>0 a[0]==123… T T F T F F Execute&Monitor Solve Choose next path Done: There is no path left. Pex is used for dynamic symbolic execution

5 Writing test scenarios for PUTs or unit tests manually is expensive Can we automatically generate test scenarios? Challenging due to large search space of possible scenarios and relevant scenarios are quite small Solution: use dynamic traces for generating test scenarios Why dynamic: precise and include concrete values Possible scenarios Relevant scenarios

6 Our approach includes three major phases Capture: Record dynamic traces and generate test scenarios for PUTs. Dynamic traces: Realistic scenarios of API calling sequences Concrete values passed to such APIs Minimize: Minimize test scenarios by filtering out duplicates Only a few scenarios are unique Explore: Generate new regression unit tests from PUTs Use Pex for generating unit tests Addresses scalability issues with a distributed setup Developed by.NET CLR test team Large number of scenarios, leading to scalability issues

7 ApplicationApplication mscorlib SystemSystem.Xml… SystemSystem.Xml….NET Base Class Libraries ProfilerProfiler Sequence Generalizer Dynamic Traces PUTsPUTs Seed unit tests Decomposer A dynamic trace captured during program execution TagRegex tagex = new TagRegex(); Match mc = Page..\u000a”,108); Capture cap = (Capture) mc; int indexval = cap.Index; A dynamic trace captured during program execution TagRegex tagex = new TagRegex(); Match mc = Page..\u000a”,108); Capture cap = (Capture) mc; int indexval = cap.Index; Parameterized unit test public static void F_1(string VAL_1, int VAL_2, out int OUT_1) { TagRegex tagex = new TagRegex(); Match mc = ((Regex)tagex).Match(VAL_1, VAL_2); Capture cap = (Capture) mc; OUT_1 = cap.Index; } Parameterized unit test public static void F_1(string VAL_1, int VAL_2, out int OUT_1) { TagRegex tagex = new TagRegex(); Match mc = ((Regex)tagex).Match(VAL_1, VAL_2); Capture cap = (Capture) mc; OUT_1 = cap.Index; } Seed unit test public static void T_1() { int index; Page..\u000a”, 108, out index); } Seed unit test public static void T_1() { int index; Page..\u000a”, 108, out index); } Developed by.NET CLR Team

8 void CoverMe(int[] a) { if (a == null) return; if (a.Length > 0) if (a[0] == ) throw new Exception("bug"); } void CoverMe(int[] a) { if (a == null) return; if (a.Length > 0) if (a[0] == ) throw new Exception("bug"); } a==null a.Length>0 a[0]==123… T T F T F F void unittest1() { CoverMe(new int[] {20}); } void unittest2() { CoverMe(new int[] {}); } void unittest1() { CoverMe(new int[] {20}); } void unittest2() { CoverMe(new int[] {}); } PUT Unit tests a==null a.Length>0 a[0]==123… T T F T F F  To exploit new feature in Pex that uses existing seed unit tests for reducing exploration time [Inspired by “Automated Whitebox Fuzz Testing” by Godefroid et al. NDSS08]

9 public static void F_1(string VAL_1, Formatting VAL_2, int VAL_3, string VAL_4, string VAL_5, WhitespaceHandling VAL_6, string VAL_7, string VAL_8, string VAL_9, string VAL_10, bool VAL_11) { Encoding Enc = UTF8; XmlWriter writer = (XmlWriter)new XmlTextWriter(VAL_1,Enc); ((XmlTextWriter)writer).Formatting = (Formatting)VAL_2; ((XmlTextWriter)writer).Indentation = (int)VAL_3; ((XmlTextWriter)writer).WriteStartDocument(); writer.WriteStartElement(VAL_4); StringReader reader = new StringReader(VAL_5); XmlTextReader xmlreader = new XmlTextReader((TextReader)reader); xmlreader.WhitespaceHandling = (WhitespaceHandling)VAL_6; bool chunk = xmlreader.CanReadValueChunk; XmlNodeType Local_ _10 = xmlreader.NodeType; XmlNodeType Local_ _11 = xmlreader.NodeType; bool Local_ _12 = xmlreader.Read(); int Local_ _13 = xmlreader.Depth; XmlNodeType Local_ _14 = xmlreader.NodeType; string Local_ _15 = xmlreader.Value; ((XmlTextWriter)writer).WriteComment(VAL_7); bool Local_ _17 = xmlreader.Read(); int Local_ _18 = xmlreader.Depth; XmlNodeType Local_ _19 = xmlreader.NodeType; string Local_ _20 = xmlreader.Prefix; string Local_ _21 = xmlreader.LocalName; string Local_ _22 = xmlreader.NamespaceURI; ((XmlTextWriter)writer).WriteStartElement(VAL_8,VAL_9,VAL_10); XmlNodeType Local_ _24 = xmlreader.NodeType; bool Local_ _25 = xmlreader.MoveToFirstAttribute(); writer.WriteAttributes((XmlReader)xmlreader,VAL_11); } public static void F_1(string VAL_1, Formatting VAL_2, int VAL_3, string VAL_4, string VAL_5, WhitespaceHandling VAL_6, string VAL_7, string VAL_8, string VAL_9, string VAL_10, bool VAL_11) { Encoding Enc = UTF8; XmlWriter writer = (XmlWriter)new XmlTextWriter(VAL_1,Enc); ((XmlTextWriter)writer).Formatting = (Formatting)VAL_2; ((XmlTextWriter)writer).Indentation = (int)VAL_3; ((XmlTextWriter)writer).WriteStartDocument(); writer.WriteStartElement(VAL_4); StringReader reader = new StringReader(VAL_5); XmlTextReader xmlreader = new XmlTextReader((TextReader)reader); xmlreader.WhitespaceHandling = (WhitespaceHandling)VAL_6; bool chunk = xmlreader.CanReadValueChunk; XmlNodeType Local_ _10 = xmlreader.NodeType; XmlNodeType Local_ _11 = xmlreader.NodeType; bool Local_ _12 = xmlreader.Read(); int Local_ _13 = xmlreader.Depth; XmlNodeType Local_ _14 = xmlreader.NodeType; string Local_ _15 = xmlreader.Value; ((XmlTextWriter)writer).WriteComment(VAL_7); bool Local_ _17 = xmlreader.Read(); int Local_ _18 = xmlreader.Depth; XmlNodeType Local_ _19 = xmlreader.NodeType; string Local_ _20 = xmlreader.Prefix; string Local_ _21 = xmlreader.LocalName; string Local_ _22 = xmlreader.NamespaceURI; ((XmlTextWriter)writer).WriteStartElement(VAL_8,VAL_9,VAL_10); XmlNodeType Local_ _24 = xmlreader.NodeType; bool Local_ _25 = xmlreader.MoveToFirstAttribute(); writer.WriteAttributes((XmlReader)xmlreader,VAL_11); }

10 ApplicationApplication mscorlib SystemSystem.Xml… SystemSystem.Xml….NET Base Class Libraries ProfilerProfiler Sequence Generalizer PUTsPUTs Seed unit tests Decomposer Statistics Size: 1.50 GB Traces: 433,809 Average trace length: 21 method calls Maximum trace length: 52 method calls Number of PUTs: 433,809 Number of seed unit tests: 433,809 Duration: 1 Machine day Statistics Size: 1.50 GB Traces: 433,809 Average trace length: 21 method calls Maximum trace length: 52 method calls Number of PUTs: 433,809 Number of seed unit tests: 433,809 Duration: 1 Machine day Dynamic Traces

11 PUTsPUTs Seed Unit Tests PexShrinkerPexShrinker PexCoverPexCover MinimizedPUTsMinimizedPUTs Seed unit tests MinimizedPUTsMinimizedPUTs Minimized Seeds PexShrinker  Detects duplicate PUTs  Uses static analysis  Compares PUTs instruction-by-instruction PexShrinker  Detects duplicate PUTs  Uses static analysis  Compares PUTs instruction-by-instruction PexCover  Detects duplicate seed unit tests Duplicate test exercises the same execution path as some other test  Uses dynamic analysis  Uses path coverage information PexCover  Detects duplicate seed unit tests Duplicate test exercises the same execution path as some other test  Uses dynamic analysis  Uses path coverage information  Filters out duplicate PUTs and seed unit tests to help Pex in generating regression tests

12 void TestMe1(int arg1, int arg2, int arg3) { if (arg1 > 0) Console.WriteLine("arg1 > 0"); /*Statement 1*/ else Console.WriteLine("arg1 <= 0"); /*Statement 2*/ if (arg2 > 0) Console.WriteLine("arg2 > 0"); /*Statement 3*/ else Console.WriteLine("arg2 <= 0"); /*Statement 4*/ for (int c = 1; c <= arg3; c++) { Console.WriteLine(“loop”) /*Statement 5*/ } void TestMe1(int arg1, int arg2, int arg3) { if (arg1 > 0) Console.WriteLine("arg1 > 0"); /*Statement 1*/ else Console.WriteLine("arg1 <= 0"); /*Statement 2*/ if (arg2 > 0) Console.WriteLine("arg2 > 0"); /*Statement 3*/ else Console.WriteLine("arg2 <= 0"); /*Statement 4*/ for (int c = 1; c <= arg3; c++) { Console.WriteLine(“loop”) /*Statement 5*/ } public void UnitTest1() { TestMe(1, 1, 1); } public void UnitTest1() { TestMe(1, 1, 1); } public void UnitTest2() { TestMe(1, 10, 1); } public void UnitTest2() { TestMe(1, 10, 1); } public void UnitTest3() { TestMe(5, 8, 2); } public void UnitTest3() { TestMe(5, 8, 2); } Path: 1  3  5 Path: 1  3  5  5 void TestMe2(int arg1, int arg2, int arg3) { if (arg1 > 0) Console.WriteLine("arg1 > 0"); /*Statement 1*/ else Console.WriteLine("arg1 <= 0"); /*Statement 2*/ if (arg2 > 0) Console.WriteLine("arg2 > 0"); /*Statement 3*/ else Console.WriteLine("arg2 <= 0"); /*Statement 4*/ for (int c = 1; c <= arg3; c++) { Console.WriteLine(“loop”) /*Statement 5*/ } void TestMe2(int arg1, int arg2, int arg3) { if (arg1 > 0) Console.WriteLine("arg1 > 0"); /*Statement 1*/ else Console.WriteLine("arg1 <= 0"); /*Statement 2*/ if (arg2 > 0) Console.WriteLine("arg2 > 0"); /*Statement 3*/ else Console.WriteLine("arg2 <= 0"); /*Statement 4*/ for (int c = 1; c <= arg3; c++) { Console.WriteLine(“loop”) /*Statement 5*/ }

13 void TestMe(int arg1, int arg2, int arg3) { if (arg1 > 0) Console.WriteLine("arg1 > 0"); /*Statement 1*/ else Console.WriteLine("arg1 <= 0"); /*Statement 2*/ if (arg2 > 0) Console.WriteLine("arg2 > 0"); /*Statement 3*/ else Console.WriteLine("arg2 <= 0"); /*Statement 4*/ for (int c = 1; c <= arg3; c++) { Console.WriteLine(“loop”) /*Statement 5*/ } void TestMe(int arg1, int arg2, int arg3) { if (arg1 > 0) Console.WriteLine("arg1 > 0"); /*Statement 1*/ else Console.WriteLine("arg1 <= 0"); /*Statement 2*/ if (arg2 > 0) Console.WriteLine("arg2 > 0"); /*Statement 3*/ else Console.WriteLine("arg2 <= 0"); /*Statement 4*/ for (int c = 1; c <= arg3; c++) { Console.WriteLine(“loop”) /*Statement 5*/ } public void UnitTest1() { TestMe(1, 1, 1); } public void UnitTest1() { TestMe(1, 1, 1); } public void UnitTest2() { TestMe(1, 10, 1); } public void UnitTest2() { TestMe(1, 10, 1); } public void UnitTest3() { TestMe(5, 8, 2); } public void UnitTest3() { TestMe(5, 8, 2); } Path: 1  3  5 Path: 1  3  5  5

14 A light-weight tool for detecting duplicate unit tests Based on Extended Reflection Can handle gigabytes of tests (~ 500,000) Generates multiple projects based on heuristics Generates two reports: Coverage report report report Test report report report Supports popular unit test frameworks: Visual studio, XUnit, NUnit, and MBUnit

15 PUTsPUTs Seed Unit Tests PexShrinkerPexShrinker PexCoverPexCover MinimizedPUTsMinimizedPUTs MinimizedPUTsMinimizedPUTs Minimized Seeds PexShrinker  Total PUTs: 433,089  Minimized PUTs: 68,575  Duration: 45 min PexShrinker  Total PUTs: 433,089  Minimized PUTs: 68,575  Duration: 45 min PexCover  Total UTs: 410,600 (Ignored ~20,000 tests due to an issue in CLR)  Number of projects: 943  Minimized UTs: 128,185  Duration: ~ 5 hours PexCover  Total UTs: 410,600 (Ignored ~20,000 tests due to an issue in CLR)  Number of projects: 943  Minimized UTs: 128,185  Duration: ~ 5 hours Machine configuration:  Xeon GHz, 8 cores  RAM 16GB Machine configuration:  Xeon GHz, 8 cores  RAM 16GB

16 A sequence captured during program execution TagRegex tagex = new TagRegex(); Match mc = Page..\u000a”,108); Capture cap = (Capture) mc; int indexval = cap.Index; A sequence captured during program execution TagRegex tagex = new TagRegex(); Match mc = Page..\u000a”,108); Capture cap = (Capture) mc; int indexval = cap.Index; Parameterized unit test public static void F_1(string VAL_1, int VAL_2, out int OUT_1) { TagRegex tagex = new TagRegex(); Match mc = ((Regex)tagex).Match(VAL_1, VAL_2); Capture cap = (Capture) mc; OUT_1 = cap.Index; } Parameterized unit test public static void F_1(string VAL_1, int VAL_2, out int OUT_1) { TagRegex tagex = new TagRegex(); Match mc = ((Regex)tagex).Match(VAL_1, VAL_2); Capture cap = (Capture) mc; OUT_1 = cap.Index; } Seed Unit test public static void T_1() { int index; Page..\u000a”, 108, out index); } Seed Unit test public static void T_1() { int index; Page..\u000a”, 108, out index); } Generated test 1 [PexRaisedException(typeof(ArgumentNullException))] public static void F_102() { int i = default(int); F_1 ((string)null, 0, out i); } Generated test 1 [PexRaisedException(typeof(ArgumentNullException))] public static void F_102() { int i = default(int); F_1 ((string)null, 0, out i); } Generated test 2 public static void F_103() { int i = default(int); F_1 ("\0\0\0\0\0\0\0<\u013b\0", 7, out i); PexAssert.AreEqual (0, i); } Generated test 2 public static void F_103() { int i = default(int); F_1 ("\0\0\0\0\0\0\0<\u013b\0", 7, out i); PexAssert.AreEqual (0, i); } Generated test 3 [PexRaisedException(typeof(ArgumentOutOfRangeExce ption))] public static void F_110() { int i = default(int); F_1("", 1, out i); } Generated test 3 [PexRaisedException(typeof(ArgumentOutOfRangeExce ption))] public static void F_110() { int i = default(int); F_1("", 1, out i); } … … Regression Tests (Total: 86)

17 Use a distributed setup Runs forever in iterations Each iteration is bounded by parameters such as timeout Doubles parameters in further iterations Use existing unit tests as a seed for first iteration (inspired by “Automated whitebox fuzz testing” Godefroid et al. NDSS08) Use generated tests in iteration X as a seed for iteration X + 1

18 MinimizedPUTsMinimizedPUTs Unit Tests Exploration tasks P1P1P1P1 P1P1P1P1 P2P2 P3P3P3P3 P3P3P3P3 P4P4P4P4 P4P4P4P4 … Computers … PexCoverPexCover Coverage & Test reports Coverage & Test reports IterationRun Timeout Constraint Timeout …Block Coverage 132…80 264… … 4128…193 Merged An iteration is finished when all exploration tasks are finished System.Web.RegularExpressions.TagRegexRunner1.Go

Do regression tests generated by our approach achieve higher code coverage? Compare initial coverage achieved by dynamic traces (base coverage) and new coverage achieved by generated tests Do existing unit tests help achieve higher coverage than without using the tests? Compare coverages with/without using existing tests as seeds Does more machine power help achieve higher coverage (when to stop?) Compare coverages achieved after first and second iterations

Applied our approach on 10.NET 2.0 base libraries Already extensively tested for several years >10,000 public methods >100,000 basic blocks Sandbox Restriction of access to external resources (files, registry, unsafe code, …) pic pic Machines 20 ConfigurationNumber Xeon GHz, 8 cores, 16 GB RAM1 Quad core GHz, 8 cores, 8 GB RAM2 Intel Xeon GHz, 1 GB RAM6

S.NoRun TypeIteration# Generated Tests Block Coverage% increase from Base 1Without Seeds1248, ~0% 2Without Seeds2412, % 3With Seeds1376, % 4With Seeds2501, % Coverage comparison report: mergedcov.htmlmergedcov.html Four runs: with/without seeds, Iteration 1 and 2. Each run took ~2 days 10.NET 2.0 base libraries: mscorlib, System, System.Windows.Forms, System.Drawing, System.Xml, System.Web.RegularExpressions, System.Configuration, System.Data, System.Web, System.Transactions Base Coverage: blocks

Do generated regression tests achieve higher code coverage? Generated regression tests achieved 24.30% more coverage than the Base

Do seed unit tests help achieve more coverage than without using seeds? Using seeds: achieved 18.6% more coverage than without using the tests Without using seeds: achieved 4.80% more coverage than Base

Does more machine power help to achieve more coverage? With seeds, Iteration 2 achieved 2.0% more coverage than Iteration 1

Does more machine power help to achieve more coverage? With out seeds, Iteration 2 achieved 5.73% more coverage than Iteration 1

An approach that automatically generates regression unit tests from dynamic traces A tool, called PexCover, that can detect duplicate unit tests A distributed setup that addresses scalability issues Our regression tests achieved 24.30% higher coverage than initial coverage by dynamic traces Ongoing and Future work Analyze exceptions exceptions.html exceptions.html Generate new sequences using evolutionary or random approaches Improve regression detection capabilities

S.No.Run TypeIteration# Generated Tests Dynamic Coverage (Covered/Reached) (%) 1Without Seeds1248, /31730 (69.08%) 2Without Seeds2412, /32838 (70.58%) 3With Seeds1376, /36845 (73.11%) 4With Seeds2501, /37081 (74.12%) Dynamic Coverage: Covered blocks / Total number of blocks in all methods reached so far Coverage comparison report: mergedcov.htmlmergedcov.html Four runs: with/without seeds, Iteration 1 and 2. Each run took ~2 days 10.NET 2.0 base libraries: mscorlib, System, System.Windows.Forms, System.Drawing, System.Xml, System.Web.RegularExpressions, System.Configuration, System.Data, System.Web, System.Transactions

29 Writing PUTs manually is expensive Can we automatically generate Test Scenarios for PUTs? Automatic method-sequence generation approaches can help? Bounded-exhaustive [Khurshid et al. TACAS03, Xie et al. ASE04] Evolutionary [Tonella ISSTA04, Inkumsah & Xie ASE08] Random [Pacheco et al. ICSE07] Heuristic [Tillmann & Halleux TAP08] Not able to achieve high code coverage [Thummalapenta et al. FSE09] Either random or rely on implementations of method calls Do not use how method calls are used in practice How to address scalability issues in dynamic symbolic execution of large number of PUTs?

30 DynamicTraces(433,809)DynamicTraces(433,809) PUTs(68,575)UTs(501,799)PUTs(68,575)UTs(501,799) PUTs(68,575)UTs (128,185), PUTs(68,575)UTs Minimize by removing redundancy among PUTs and UTs Maximize with new non-redundant UTs PUTs(433,809)UTs(433,809)PUTs(433,809)UTs(433,809) Legend: UT: Unit Test