1 / 1

Tao Xie ( taoxie@cs.washington.edu ) Advisor: David Notkin Department of Computer Science & Engineering, Universit

Automatic Identification of Common and Special Object-Oriented Unit Tests. Common tests. Common or universal properties. Special tests. Abstraction templates. Problem. Solution. Test identification. Method-call composition. Test generation. Statistical inference. References.

xuan
Download Presentation

Tao Xie ( taoxie@cs.washington.edu ) Advisor: David Notkin Department of Computer Science & Engineering, Universit

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automatic Identification of Common and Special Object-Oriented Unit Tests Commontests Common oruniversal properties Specialtests Abstractiontemplates Problem Solution Testidentification Method-call composition Test generation Statisticalinference References Related Work Tao Xie (taoxie@cs.washington.edu) Advisor: David Notkin Department of Computer Science & Engineering, University of Washington, Seattle Results for java.util.LinkedList • g(f(S, args1).state, args2).retval == const • g(f(S, args1).state, args2).state == f(g(S, args1).state, args2).state • … S1 • Programmers often overlook some special or even commontests • Automatic test generation tools produce a large number of tests • How to automatically identify special tests and common tests from them? • 79 common tests and 29 special tests (8 tests are both common and special) identified out of 6777 automatically generated tests. • 43 universal properties and 45 common properties. • Generate representative method arguments • Iteratively invoke different arguments on each non-equivalent receiver-object(e.g. five iterations) • [Xie et al. 04] clear … S2 == S3 size … Some Examples of Common/Special Tests S4 *. Common prop: remove(removeLast(S).state, m0_2).state == removeLast(remove(S, m0_2).state).state Satisfying count: 318 (common test) LinkedList m = new LinkedList( ); m.add (0, new Integer(-1)); m.removeLast( ); m.remove(new Integer(-1)); Violating count: 42 (special test) LinkedList m = new LinkedList( ); m.add (0, new Integer(-1)); m.add (0, new Integer(0)); m.removeLast( ); m.remove(new Integer(-1)); *. Common prop: remove(removeFirst(S).state, m0_2).retval == remove(S, m0_2).retval Satisfying count: 315 (common test) LinkedList m = new LinkedList( ); m.add (0, new Integer(-1)); m.removeFirst ( ); m.remove(new Integer(1)); Violating count: 45 (special test) LinkedList m = new LinkedList( ); m.add (0, new Integer(-1)); m.removeFirst ( ); m.remove(new Integer(-1)); Java class bytecode • Automatically identify common and special tests without requiring specifications • Based on dynamically inferred Statistical Algebraic Abstractions class bytecode *. Common prop: removeLast(addFirst(S, m0_1).state).state == addFirst(removeLast(S).state, m0_1).state Satisfying count: 117 (common test) LinkedList m = new LinkedList( ); m.add(0, new Integer(-1)); m.addFirst(new Integer(0)); m.removeLast ( ); Violating count: 3 (special test) LinkedList m = new LinkedList( ); m.addFirst(new Integer(0)); m.removeLast ( ); *. Conditional universal prop: lastIndexOf(addFirst(S, m0_1).state, m0_2).retval == (lastIndexOf(S, m0_2).retval + 1) [where (m0_1==m0_2)] Satisfying count: 120 (special test) LinkedList m = new LinkedList( ); m.addFirst(new Integer(-1)); m.lastIndexOf(new Integer(-1)); • Syntactically identical to axioms in algebraic specifications • Associated with counts of satisfying and violating instances • Universal property: all instances are satisfying instances. • Common property: instances are mostly (e.g. 80%)satisfying instances • Common testa satisfying instance of a universal property or common property • Special testa violating instance of a common property size(clear(S).state).retval == 0 Satisfying count: 121 Violating count: 0 remove(add(S, m0_1).state, m0_2).state == add(remove(S, m0_2).state, m0_1).state Satisfying count: 315 Violating count: 45 • Ernst et al., Dynamically Discovering Likely Program Invariants to Support Program Evolution, IEEE Trans. Softw. Eng, 01. • Henkel & Diwan, Discovering Algebraic Specifications from Java Classes, ECOOP 03. • Xie et al., Rostra: A Framework for Detecting Redundant Object-Oriented Unit Tests, ASE 04. • Statistical algebraic abstractions are not required to be universally true during test executions, different from properties inferred by previous approaches • [Ernst et al. 01, Henkel & Diwan 03]. java.util.LinkedList as the illustrative example 25 pub methods and more than 300 LOC http://www.cs.washington.edu/homes/taoxie/sabicu/

More Related