A Class-Level Unit Testing Tool for Java
|
|
- Marshall Banks
- 5 years ago
- Views:
Transcription
1 A Class-Level Unit Testing Tool for Java Tz-Fan Hu and Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University Chiayi 621, Taiwan, R.O.C. Abstract Software testing is the main activity to ensure the quality of software. This article applies a black-box testing technique to automatically generate test cases for Java programs. This article generates test cases for Java classes based on the software specification using the UML state diagrams and the Object Constraint Language (OCL). This article is based on the UML class diagrams and the Object Constraint Language to specify the behavior of Java methods by defining the preconditions and postconditions of Java methods and class invariants proposed in the Design by Contract software development approach. This article then uses the UML state diagrams and the Object Constraint Language to specify the dynamic behavior of Java objects. An automatic testing tool is developed to generate Java test classes for the Java classes under test. The testing framework is based on the JUnit framework. The automatic generation of the test input and expected output for each test case is based on the powerful constraint solving capability of constraint logic programming. A novel characteristic of this approach is that a test input and its corresponding expected output are simultaneously generated in a unified way. 1. Introduction According to 2006 CHAOS report of the Standish Group, high quality software is still very hard to achieve at present [15]. The software testing activity still remains one of the main activities to assure software quality. The cost of the software testing activity usually takes about half of the cost of the entire software process. This high cost of the software testing activity is the main reason to hinder the achievement of high quality software. Many software testing techniques have been developed during the last several decades. However, most of these software testing techniques are still performed manually. This is why the cost of the software testing activity is so high. The automation of the software testing activity should be able to significantly reduce the cost of the software testing activity. The software testing activity consists of the design of test cases and the execution of test cases. There are two types of techniques for designing test cases: black-box testing (or specification-based testing) and white-box testing (or program-based testing) [3]. The black-box techniques are based on the functional specification of a software system and focus on the coverage of the specified external behaviors of the software system. The white-box techniques are based on the source code and focus on the coverage of the internal structure of the source code. These two types of techniques are complementary. The white-box techniques alone may fail to reveal that some portions of the specification are missed in the source code. On the other hand, the black-box testing techniques alone may fail to reveal that some portions of the source code are not contained in the specification. Therefore, employing both types of techniques is necessary to assure high quality software. Design by Contract is a systematic approach for developing bug free software [8]. In Design by Contract approach, the functional behaviors of a class are specified as a contract. The contract specifies the correct interactions between a class and its clients as a set of obligations that need to be fulfilled by both parties. If both parties fulfill their
2 obligations, the interactions between the two parties are guaranteed to be correct. Developing the contract of a software system is the first and perhaps the most difficult task of developing the software system. However, if we cannot develop the contract of a software system, it is little likelihood that the developed software system will behave as it is supposed to behave. In Design by Contract approach, three kinds of constraints are used to specify the functional behaviors of a class. The preconditions of a method in the class specify the set of constraints that need to be satisfied before the method can correctly execute. The postconditions of a method in the class specify the set of constraints that is guaranteed to be satisfied after the method is correctly executed. The invariants of a class specify the set of constraints that is always satisfied by an object of the class. Unified Modeling Language (UML) is a standardized general-purpose modeling language. A UML class diagram (CD) describes the attributes and the methods in a Java class. Object Constraint Language (OCL) is a specification language that can be used to specify the three kinds of constraints in Design by Contract approach [11]. Given the contract for a Java class specified in OCL, the test cases for the methods in the class can be automatically designed using the black-box technique. The contract in the Design by Contract approach specifies the functional behavior of a Java object for a single method invocation. The UML state diagrams (SD) and the OCL specification on the state diagrams can be used to specify the functional behavior of a Java object for a sequence of method invocations. Thus, a specification including class diagrams, state diagrams, and OCL is a more complete specification for a class. The structure of a class-level unit test tool for Java is shown in Figure 1. This tool contains three components: a test path generator, a test data generator, and a test class generator. The test path generator first reads in a UML class diagram, a state diagram, and the corresponding OCL specifications for the methods in the class. It then enumerates a possible test path from the specification. The test data generator then checks the feasibility of the test path by solving the set of logical constraints appearing on the test path. If the set of logical constraints is satisfiable, this test path is feasible. In this case, a solution of the set of logical constraints is used as a representative test input and its corresponding expected output. Otherwise, the test path is infeasible and is abandoned. The test path generator and the test data generator perform repeatedly until the set of generated feasible test paths satisfies a specific test coverage criterion. The test class generator then generates a Java test class for the tested Java class based on the set of generated test inputs and their corresponding expected outputs. Most modern black-box unit testing tools focus on the automation of test path generators and the test class generator. The tasks of test data generators are still usually performed manually by programmers or testers. This article proposes an approach that can automatically generate the test input and expected output simultaneously based on the powerful constraint solving capability of the Constraint Logic Programming system ECLiPSe [1]. The automatic execution of test cases is based on the JUnit framework [2]. This article uses the Java development environment Eclipse to develop the testing tool [12]. The rest of the article is organized as follows. Section 2 describes a running example for this article and gives a specification for the running example. Section 3 describes the test path generator. Section 4 describes the test data generator. Section 5 describes the test class generator. Section 6 reviews related work. Finally, Section 7 concludes this article. 2. A Running Example We now describe a running example that is used to illustrate the automatic test case generation for Java classes. Consider the following Java class Stack.
3 UML CD, SD, and OCL Test Path Generator Test Path Infeasible Test Path Test Data Generator Feasible Test Path + Test Input + Expected output Coverage Criterion Satisfied Y N Test Class Generator Java Test Class Figure 1. The structure of a class-level unit testing tool for Java. class Stack { private Sequence stack; public Stack(); public void push(int element); public void pop(); public int peek( ); public int size(); } Each object of the class Stack represents a stack of integer elements. The variable stack represents the sequence of integer elements in the stack. We assume that the type Sequence is an abstract ordered-bag collection type that can be implemented using a suitable Java collection type. The constructor Stack() creates a Stack object with zero element. The method push(int element) pushes an element element into the stack. The method pop() pops an element out of the stack. The method peek( ) returns the top element of the stack. The method size( ) returns the number of elements in the stack. The methods can be divided into two categories: update and query methods. The update methods like push and pop will change the state of the object. The query methods like peek and size only return the status of the state of the object.
4 The OCL specification for the methods in the class Stack is given as follows: context Stack:: Stack() post: stack = Sequence{} context Stack::push(element: Integer) post: stack = stack@pre->prepend(element) context Stack::pop() pre: stack@pre->size() > 0 post: stack = stack@pre-> subsequence(2, stack@pre->size()) context Stack::peek(): Integer pre: stack@pre->size() > 0 post: result = stack@pre->first() context Stack::size(): Integer post: result = stack@pre->size() The type Sequence is a predefined ordered-bag collection type in the OCL. The postcondition for the constructor Stack() specifies that an empty sequence is created and is set to attribute stack. The postcondition for the method push(element: Integer) specifies that an integer element element is inserted into the sequence at the beginning. In the postcondition, the expression stack denotes the value of attribute stack right after the method invocation, while the expression stack@pre denotes the value of attribute stack right before the method invocation. The OCL predefined operation prepend(x) inserts its argument x into the sequence at the beginning. In the preconditions for the methods pop() and peek(), the OCL predefined operation size() returns the number of elements in the sequence. Thus, the preconditions specify that the number of elements in the sequence must be greater than zero. The OCL predefined operation subsequence(n, m) returns the subsequence from the n th element to the m th element. The postcondition for the method pop() thus specifies that the attribute stack is set to the push() push() empty nonempty pop()[size() = 1] pop()[size() > 1] Figure 2. The state diagram of class Stack. subsequence from the second element to the last element. The OCL predefined operation first() returns the first element of the sequence. The postcondition for the method peek() thus specifies that the method returns the first element of the sequence. The postcondition for the method size() thus specifies that the method returns the number of elements in the sequence. The state diagram for the class is given in Figure 2. This diagram specifies the dynamic behavior of a stack object. Note that only the update methods push and pop appear in the state diagram because the query methods peek and size do not change the state of the object. 3. The Test Path Generator The test path generator consists of two steps. First, it reads in a state diagram and its corresponding OCL specification. Second, it then enumerates all the possible test paths in the state diagram. The enumeration schemes of test paths depend on the test coverage criterion chosen. The test coverage criterion can be control-flow based: all-decision, all-condition, or all-decision-condition, or data-flow based: all-define, all-use, or all-define-use. In this article, we will assume that the all-define-use test coverage criterion is used. Therefore, the test path generator needs to find all the define-use pairs in the state diagram before enumerating test paths. For the running example, stack is the only
5 def 0 def 1 use 1 push() push() def 2 use 2 following example. %Include constraint solving library empty nonempty :- lib(ic). attribute in the class. All the definitions and uses of stack are shown in Figure 3. There are a total of 9 define-use pairs in the state diagram: def 0 -use 1, def 1 -use 2, def 1 -use 4, def 2 -use 2, def 2 -use 3, def 3 -use 2, def 3 -use 3, def 3 -use 4, def 4 -use 1. Using the all-define-use test coverage criterion, the following two paths will be enumerated by the test path generator: 1: push-pop-push-pop. 2: push-push-push-pop-push-pop-pop-pop. The first test path covers the following define-use pairs: def 0 -use 1, def 1 -use 4, def 4 -use 1. The second test path covers the following define-use pairs: def 1 -use 2, def 2 -use 2, def 2 -use 3, def 3 -use 2, def 3 -use 3, def 3 -use 4. These two paths will be passed to the test data generator. 4. The Test Data Generator The test data generator generates a sequence of arguments for the sequence of method invocations in each test path passed from the test path generator. The sequence of arguments are generated by solving the set of constraints on the test path. This set of constraints is first transformed into ECLiPSe predicates and these predicate are then solved by the powerful constraint solving capability of the ECLiPSe system. def pop()[size() = 1] 3 use 3 def 4 pop()[size() > 1] use 4 Figure 3. The definitions and uses of stack in the state diagram of class Stack. The powerful constraint solving capability of the ECLiPSe system can be illustrated by the foo(a, B, C) :- % Domains of variables [A, B, C] :: 1.. 3, % Constraints on variables A #= B + C, % Solving constraints indomain(a), indomain(b), indomain(c), locate([a, B, C], 0.1). where ic is the library for solving constraints on finite domains. The ECLiPSe system supports several other libraries. Based on the unification mechanism of logic programming, the predicate foo/3 can be queried with any number of variable arguments. For example, the predicate foo/3 can be queried using any of foo(3, 1, 2), foo(3, 1, C), foo(3, B, C), foo(a, B, C), and so on. This unification mechanism allows us to solve the test input and expected output simultaneously. By specifying the domains of variables, the constraint solving library can find all the solutions satisfying the constraints in the predicate. For the example, the ECLiPSe system will returns A = 3, B = 1, C = 2, and A = 3, B = 2, C = 1, as solutions for the query foo(a, B, C). For each method method in the class class, the test data generator will convert its postcondition into an ECLiPSe predicate classmethod(ostate, Arguments, Result, NState). The argument OState is the state of the object right before the
6 method invocation. The state consists of the list of attribute values of the object. The argument Arguments is the list of arguments to the method invocation. The argument Result is the returned value of the method invocation. The argument NState is the state of the object right after the method invocation. For the running example, the test data generator will generate the following predicates: stackstack(_, [], [], stack(s)) :- sequencesequence([], S). stackpush(stack(s),[element],[], stack(ns)): [Element] :: , sequenceprepend(s, Element, NS). stackpop(stack(s),[],[], stack(ns)) :- sequencesize(s, Size), sequencesubsequence(s, 2, Size, NS). stackpeek(stack(s), [], Element, stack(s)) :- [Element] :: , sequencefirst(s, Element). stacksize(stack(s), [], Size, stack(s)) :- sequencesize(s, Size). where the predicates sequencesequence/2, sequenceprepend/3, sequencesize/2, sequencesubsequence/4, and sequencefirst/2 are the CLP implementation of the builtin operations of the OCL sequence collection type. The test data generator will also convert the sequence of method invocations and guards on the test paths into an ECLiPSe predicate testclass(pathno, Arguments, Input, Output). The argument PathNo is the path identification number. The argument Arguments is the sequence of arguments in the method invocations. The argument Inputs is the list of arguments passed to the object state queries. The argument Outputs is the list of values returned from the object state queries. We should use both query methods peek and size to query the state of the object. However, due to the comprehension of presentation, we only use the query method size in this example. Each test path corresponds to a clause of the predicate testclass/4. For the running example, the test data generator will generate the following clause for the test path 1: teststack(1, Arguments, Inputs, Outputs) :- % clause for test path 1 stackstack(_, Arg0, _, S0), Arguments = [Arg0 R1], stacksize(s0, In1, Out1, _), % check Inputs = [In1 RIn1], Outputs = [Out1 Rout1], stackpush(s0, Arg1, _, S1), R1 = [Arg1 R2], stacksize(s1, In2, Out2, _), % check RIn1 = [In2 RIn2], Rout1 = [Out2 Rout2], stacksize(s1, Arg2, Res1, S2), % guard R2 = [Arg2 R3], Res1 #= 1, stackpop(s2, Arg3, _, S3), R3 = [Arg3 R4], stacksize(s3, In3, Out3, _), % check RIn2 = [In3 RIn3], Rout2 = [Out3 Rout3], stackpush(s3, Arg4, _, S4), R4 = [Arg4 R5], stacksize(s4, In4, Out4, _), % check RIn3 = [In4 RIn4], Rout3 = [Out4 Rout4], stacksize(s4, Arg5, Res2, S5), % guard R5 = [Arg5 R6], Res2 #= 1, stackpop(s5, Arg6, _, S6), R6 = [Arg6], stacksize(s6, In5, Out5, _), % check RIn4 = [In5 RIn5], Rout4 = [Out5 Rout5].
7 Query the ECLiPSe system using the following query: teststack(1, Args, Ins, Outs). The ECLiPSe system will return Args = [[], [0], [], [], [0], [], []], Ins = [[], [], [], [], []], Outs = [0, 1, 0, 1, 0]; 5. The Test Class Generator The test class generator generates a Java test class for the class under test. The test class is based on the JUnit framework. For each test path, there is a corresponding test method. For each selected feasible test path, the test class generator generates code to invoke the sequence of method invocations and to check if the actual output of the invoked method is the same as the expected output using the JUnit macro assertequals. For the running example, the test class generator generates the following test method for the first test path. public class TriangleTest extends TestCase { public void teststack1() { Stack s = new Stack(); assertequals(0, s.size()); s.push(0); assertequals(1, s.size()); s.pop(); assertequals(0, s.size()); s.push(0); assertequals(1, s.size()); s.pop(); assertequals(0, s.size()); } } 6. Related Work The Design by Contract is first proposed and designed in the programming language Eiffel [9]. The Eiffel contracts are part of the Eiffel programming language and can be executed directly. The AutoTest unit testing framework automates test case generation based on the Eiffel contracts [10]. The AutoTest framework uses the adaptive random testing to generate test input and executes the postcondition to generate expected output. The Java Modeling Language (JML) is a Design by Contract specification language for Java [6]. The JML contracts are specified in Java syntax. The JML unit testing framework automates test case generation based on the JML contracts [4]. The JML framework uses the random testing and the constraint-solving on the precondition to generate test input and executes the postcondition to generate expected output. The CASE tool AutoFocus is a model-based development tool for reactive systems [5]. The AutoFocus tool uses the System Structure Diagrams to specify the interaction structure of components and the State Transition Diagrams to specifies the behavior of a component. The AutoFocus tool uses the symbolic execution of constraint logic programming to generate test input and expected output [7, 13, 14]. Our approach is most similar to the approach of the AutoFocus tool. 7. Conclusion Automatic generation of input data and expected output is the most difficult tasks in software testing activity. The automation of any task depends on the formal specification of the task. This article uses UML state diagrams and the Object Constraint Language as a formal language to specify the dynamic behavior of Java objects. This article uses the powerful constraint solving capability of constraint logic programming to automatically generate test input and expected output for test cases. This approach can generate the test input and expected output simultaneously. This article shows that the integration of UML state diagrams, OCL, and CLP makes the design and implementation of an
8 automatic testing tool for Java classes possible. Acknowledgements This work was supported in part by the National Science Council of R.O.C. under grant number NSC E References [1] K. R. Apt and M. G. Wallace, Constraint Logic Programming Using ECLiPSe, Cambridge University Press, [2] K. Beck and E. Gamma, JUnit Cookbook, [3] B. Bezier, Software Testing Techniques, 2nd Edition, Van Nostrand, [4] Y. Cheon, A. Cortes, M. Ceberio, and G. T. Leavens, Integrating Random Testing with Constraints for Improved Efficiency and Diversity, Proceedings of the 20th International Conference on Software Engineering and Knowledge Engineering, [5] F. Huber, B. Schatz, G. Einert, Consistent Graphical Specification of Distributed Systems, Proceedings of the Conference on Industrial Applications and Strengthened Foundations of Formal Methods, 1997, pp [6] G. T. Leavens, A. L. Baker, and C. Ruby, JML: A Notation for Detailed Design, In H. Kilov, B. Rumpe, and I. Simmonds (editors), Behavioral Specifications of Businesses and Systems, Kluwer, 1999, Chapter 12, pp [7] H. Lötzbeyer, A. Pretschner, and Er Pretschner, AutoFocus on Constraint Logic Programming, Proceedings of (Constraint) Logic Programming and Software Engineering, [8] B. Meyer, Design by Contract, In Advances in Object-Oriented Software Engineering, eds. D. Mandrioli and B. Meyer, Prentice Hall, 1991, pp [9] B. Meyer, Eiffel: the Language, Prentice Hall, [10] B. Meyer, H. Ciupa, A. Leitner, and L. Liu, Automatic Testing of Object-Oriented Software, SOFSEM 2007: Theory and Practice of Computer Science, Springer, 2007, pp [11] Object Management Group, Object Constraint Language Specification, Version 2.0, [12] Object Technology International Incorporation, Eclipse Platform Technical Overview, [13] A. Pretschner and H. Lötzbeyer, Model Based Testing with Constraint Logic Programming: First Results and Challenges, Proceedings of Second International Workshop on Automated Program Analysis, Testing and Verification, 2001, pp [14] A. Pretschner, O. Slotosch, E. Aiglstorfer, and S. Kriebel, Model Based Testing for Real: The Inhouse Card case Study, International Journal on Software Tools for Technology Transfer, 5(2-3): , March [15] Standish Group, 2006 CHAOS Report, 2007.
Automatic Black-Box Method-Level Test Case Generation Based on Constraint Logic Programming
Automatic Black-Box Method-Level Test Case Generation Based on Constraint Logic Programming i-tin Hu and ai-wei Lin Department of Computer Science and Information Engineering ational Chung Cheng University
More informationTest Case Generation Based on Sequence Diagrams
Test Case Generation Based on Sequence Diagrams Yao-Cheng Lei Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University Chiayi, Taiwan 621, R.O.C. {lyc94,naiwei}@cs.ccu.edu.tw
More informationObject Oriented Program Correctness with OOSimL
Kennesaw State University DigitalCommons@Kennesaw State University Faculty Publications 12-2009 Object Oriented Program Correctness with OOSimL José M. Garrido Kennesaw State University, jgarrido@kennesaw.edu
More informationTest Driven Development with Oracles and Formal Specifications
Test Driven Development with Oracles and Formal Specifications Shadi Alawneh and Dennis Peters Faculty of Engineering and Applied Science Memorial University, St.John s, NL Canada A1B 3X5 {shadi.alawneh,dpeters}@mun.ca
More informationTIME-BASED CONSTRAINTS IN THE OBJECT CONSTRAINT LANGUAGE OCL
TIME-BASED CONSTRAINTS IN THE OBJECT CONSTRAINT LANGUAGE OCL Ali Hamie, John Howse School of Computing, Mathematical and Information Sciences, University of Brighton, Brighton, UK. {a.a.hamie@brighton.ac.uk,
More informationA Constraint-Based Framework for Test Case Generation in Method-Level Black-Box Unit Testing
JOURNAL OF INFORMATION SCIENCE AND ENGINEERING 32, 365-387 (2016) A Constraint-Based Framework for Test Case Generation in Method-Level Black-Box Unit Testing CHI-KUANG CHANG AND NAI-WEI LIN 1,2 Department
More informationBlack Box Testing. EEC 521: Software Engineering. Specification-Based Testing. No Source Code. Software Testing
Black Box Testing EEC 521: Software Engineering Software Testing Black-Box Testing Test-Driven Development Also known as specification-based testing Tester has access only to running code and the specification
More informationUC Santa Barbara. CS189A - Capstone. Christopher Kruegel Department of Computer Science UC Santa Barbara
CS189A - Capstone Christopher Kruegel Department of Computer Science http://www.cs.ucsb.edu/~chris/ Design by Contract Design by Contract and the language that implements the Design by Contract principles
More informationAn Introduction to Systematic Software Testing. Robert France CSU
An Introduction to Systematic Software Testing Robert France CSU Why do we need to systematically test software? Poor quality products can Inconvenience direct and indirect users Result in severe financial
More informationFirst Steps Towards Conceptual Schema Testing
First Steps Towards Conceptual Schema Testing Albert Tort and Antoni Olivé Universitat Politècnica de Catalunya {atort,olive}@lsi.upc.edu Abstract. Like any software artifact, conceptual schemas of information
More informationNo Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages
No Source Code : Software Testing Black-Box Testing Test-Driven Development No access to source code So test cases don t worry about structure Emphasis is only on ensuring that the contract is met Specification-Based
More informationThe Contract Pattern. Design by contract
The Contract Pattern Copyright 1997, Michel de Champlain Permission granted to copy for PLoP 97 Conference. All other rights reserved. Michel de Champlain Department of Computer Science University of Canterbury,
More informationTesting, Debugging, Program Verification
Testing, Debugging, Program Verification Automated Test Case Generation, Part II Wolfgang Ahrendt & Vladimir Klebanov & Moa Johansson 12 December 2012 TDV: ATCG II /GU 2011-12-12 1 / 17 Recap Specification-/Model-Based
More informationTest First Software Development
Test First Software Development Jacob Kristhammar Roger Schildmeijer D04, Lund Institute of Technology, Sweden {d04jk d04rp}@student.lth.se 2008-02-06 Abstract In this in-depth study we will try to explain
More informationWhy Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012
Why Design by Contract What s the difference with Testing? CS 619 Introduction to OO Design and Development Design by Contract Fall 2012 Testing tries to diagnose (and cure) defects after the facts. Design
More informationCSE 331 Midterm Exam 2/13/12
Name There are 10 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes, closed
More informationSpecification and Verification of Garbage Collector by Java Modeling Language
Specification and Verification of Garbage Collector by Java Modeling Language Wenhui Sun, Yuting Sun, Zhifei Zhang Department of Computer Science and Technology Beijing Jiaotong University Beijing, China
More informationJUnit in EDA Introduction. 2 JUnit 4.3
Lunds tekniska högskola Datavetenskap, Nov 25, 2010 Görel Hedin EDA260 Programvaruutveckling i grupp projekt Labb 3 (Test First): Bakgrundsmaterial JUnit in EDA260 1 Introduction The JUnit framework is
More informationExploiting Synergy Between Testing and Inferred Partial Specifications
Exploiting Synergy Between Testing and Inferred Partial Specifications Tao Xie David Notkin Department of Computer Science & Engineering, University of Washington {taoxie, notkin}@cs.washington.edu Technical
More informationAutomatic Extraction of Abstract-Object-State Machines Based on Branch Coverage
Automatic Extraction of Abstract-Object-State Machines Based on Branch Coverage Hai Yuan Department of Computer Science North Carolina State University Raleigh, NC 27695 hyuan3@ncsu.edu Tao Xie Department
More information3. Design by Contract
3. Design by Contract Oscar Nierstrasz Design by Contract Bertrand Meyer, Touch of Class Learning to Program Well with Objects and Contracts, Springer, 2009. 2 Roadmap > Contracts > Stacks > Design by
More informationResearch Paper on Implementation of OCL Constraints in JAVA
ISSN No. 0976-5697 Volume 8, No. 5, May June 2017 International Journal of Advanced Research in Computer Science RESEARCH PAPER Available Online at www.ijarcs.info Research Paper on Implementation of OCL
More informationHomework #1, on the class web pages later today
Assertions Reading assignment A. J. Offutt, A Practical System for Mutation Testing: Help for the Common Programmer, Proceedings of the 12th International Conference on Testing Computer Software, Washington,
More informationDynamic Analysis Techniques Part 2
oftware Design (F28SD2): Dynamic Analysis Techniques Part 2 1 Software Design (F28SD2) Dynamic Analysis Techniques Part 2 Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt University
More informationLecture 10 Design by Contract
CS 5959 Writing Solid Code Fall 2015 Nov-23 Lecture 10 Design by Contract Zvonimir Rakamarić University of Utah Design by Contract Also called assume-guarantee reasoning Developers annotate software components
More informationAssertions, pre/postconditions
Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What
More informationFrom Event-B Models to Dafny Code Contracts
From Event-B Models to Dafny Code Contracts Mohammadsadegh Dalvandi, Michael Butler, Abdolbaghi Rezazadeh Electronic and Computer Science School, University of Southampton Southampton, United Kingdom {md5g11,mjb,ra3}@ecs.soton.ac.uk
More informationAn Eclipse Plug-in for Model Checking
An Eclipse Plug-in for Model Checking Dirk Beyer, Thomas A. Henzinger, Ranjit Jhala Electrical Engineering and Computer Sciences University of California, Berkeley, USA Rupak Majumdar Computer Science
More informationAutomated Random Testing to Detect Specification-Code Inconsistencies
Automated Random Testing to Detect Specification-Code Inconsistencies Yoonsik Cheon TR #07-07 February 2007; revised March 2007 Keywords: random testing, test data generator, test oracle, pre and postconditions,
More informationa correct statement? You need to know what the statement is supposed to do.
Using assertions for correctness How can we know that software is correct? It is only correct if it does what it is supposed to do. But how do we know what it is supposed to do? We need a specification.
More informationCover Page. The handle holds various files of this Leiden University dissertation
Cover Page The handle http://hdl.handle.net/1887/22891 holds various files of this Leiden University dissertation Author: Gouw, Stijn de Title: Combining monitoring with run-time assertion checking Issue
More informationA Fitness Function to Find Feasible Sequences of Method Calls for Evolutionary Testing of Object-Oriented Programs
A Fitness Function to Find Feasible Sequences of Method Calls for Evolutionary Testing of Object-Oriented Programs Myoung Yee Kim and Yoonsik Cheon TR #7-57 November 7; revised January Keywords: fitness
More informationAutomatically Extracting Mock Object Behavior from Design by Contract TM Specification for Test Data Generation
Automatically Extracting Mock Object Behavior from Design by Contract TM Specification for Test Data Generation ABSTRACT Stefan J. Galler and Andreas Maller and Franz Wotawa Institute for Software Technology
More informationIntroduction to Dynamic Analysis
Introduction to Dynamic Analysis Reading assignment Gary T. Leavens, Yoonsik Cheon, "Design by Contract with JML," draft paper, http://www.eecs.ucf.edu/~leavens/jml//jmldbc.pdf G. Kudrjavets, N. Nagappan,
More informationJML tool-supported specification for Java Erik Poll Radboud University Nijmegen
JML tool-supported specification for Java Erik Poll Radboud University Nijmegen Erik Poll - JML p.1/41 Overview The specification language JML Tools for JML, in particular runtime assertion checking using
More informationSoftwaretechnik. Lecture 08: Testing and Debugging Overview. Peter Thiemann SS University of Freiburg, Germany
Softwaretechnik Lecture 08: Testing and Debugging Overview Peter Thiemann University of Freiburg, Germany SS 2012 Literature Essential Reading Why Programs Fail: A Guide to Systematic Debugging, A Zeller
More informationAssertions. Assertions - Example
References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 11/13/2003 1 Assertions Statements about input to a routine or state of a class Have two primary roles As documentation,
More informationAdding Contracts to C#
Adding Contracts to C# Peter Lagace ABSTRACT Design by contract is a software engineering technique used to promote software reliability. In order to use design by contract the selected programming language
More informationSoftwaretechnik. Lecture 08: Testing and Debugging Overview. Peter Thiemann SS University of Freiburg, Germany
Softwaretechnik Lecture 08: Testing and Debugging Overview Peter Thiemann University of Freiburg, Germany SS 2012 Literature Essential Reading Why Programs Fail: A Guide to Systematic Debugging, A Zeller
More informationMutually Enhancing Test Generation and Specification Inference
Mutually Enhancing Test Generation and Specification Inference Tao Xie David Notkin Department of Computer Science & Engineering University of Washington August 15th, 2003 Foundations of Software Engineering,
More informationStatic program checking and verification
Chair of Software Engineering Software Engineering Prof. Dr. Bertrand Meyer March 2007 June 2007 Slides: Based on KSE06 With kind permission of Peter Müller Static program checking and verification Correctness
More informationJML Class Specifications The Java Modeling Language (Part 2) A Java Class
JML Class Specifications The Java Modeling Language (Part 2) Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria
More informationMaster Thesis Project Plan. Reusable Mathematical Models
Master Thesis Project Plan Reusable Mathematical Models Tobias K. Widmer widmer@id.ethz.ch Supervisors: Prof. Dr. B. Meyer B. Schoeller Chair of Software Engineering Department of Computer Science, ETH
More informationTool Support for Design Inspection: Automatic Generation of Questions
Tool Support for Design Inspection: Automatic Generation of Questions Tim Heyer Department of Computer and Information Science, Linköping University, S-581 83 Linköping, Email: Tim.Heyer@ida.liu.se Contents
More informationThe Java Modeling Language (Part 2)
The Java Modeling Language (Part 2) Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at
More informationDataflow testing of Java programs with DFC
Dataflow testing of Java programs with DFC Ilona Bluemke 1,, Artur Rembiszewski 1 1 Institute of Computer Science, Warsaw University of Technology Nowowiejska 15/19, 00-665 Warsaw, Poland I. Bluemke@ii.pw.edu.pl
More informationJartege : a Tool for Random Generation of Unit Tests for Java Classes
Jartege : a Tool for Random Generation of Unit Tests for Java Classes Catherine Oriat /IMAG, Grenoble, France (presented by Yves Ledru) 1 SOQUA 05, Erfurt, Germany, Sep. 22nd 2005 The need for automatic
More informationCanica: An IDE for the Java Modeling Language
Canica: An IDE for the Java Modeling Language Angelica B. Perez, Yoonsik Cheon, and Ann Q. Gates TR #06-36 August 2006 Keywords: Integrated development environment, specification tool, programming tool,
More informationJML OCL. Java. iterate
1 OCL JML OCL (Object Constraint Language) JML (Java Modelling Language) UML/OCL JML Java OCL JML iterate iterate Java OCL JML The paper presents a translation method from OCL (Object Constraint Language)
More informationCISC327 - So*ware Quality Assurance. Lecture 13 Black Box Unit
CISC327 - So*ware Quality Assurance Lecture 13 Black Box Unit Tes@ng Black Box Unit Tes@ng Black box method tes@ng Test harnesses Role of code- level specifica@ons (asser@ons) Automa@ng black box unit
More informationIntegrating White- and Black-Box Techniques for Class-Level Regression Testing
Integrating White- and Black-Box Techniques for Class-Level Regression Testing Sami Beydeda, Volker Gruhn University of Dortmund Computer Science Department Software Technology 44221 Dortmund, Germany
More informationAdvances in Programming Languages
Advances in Programming Languages Lecture 12: Practical Tools for Java Correctness Ian Stark School of Informatics The University of Edinburgh Friday 31 November 2014 Semester 1 Week 7 http://www.inf.ed.ac.uk/teaching/courses/apl
More informationAn Assertion Checking Wrapper Design for Java
An Assertion Checking Wrapper Design for Java Roy Patrick Tan Department of Computer Science Virginia Tech 660 McBryde Hall, Mail Stop 0106 Blacksburg, VA 24061, USA rtan@vt.edu Stephen H. Edwards Department
More informationSOFTWARE VERIFICATION RESEARCH CENTRE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT. No
SOFTWARE VERIFICATION RESEARCH CENTRE THE UNIVERSITY OF QUEENSLAND Queensland 4072 Australia TECHNICAL REPORT No. 02-34 Specification matching of state-based modular components David Hemer September 2002
More informationAssignment 2 - Specifications and Modeling
Assignment 2 - Specifications and Modeling Exercise 1 A way to document the code is to use contracts. For this exercise, you will have to consider: preconditions: the conditions the caller of a method
More informationThe Java Modeling Language JML
The Java Modeling Language JML Néstor Cataño ncatano@puj.edu.co Faculty of Engineering Pontificia Universidad Javeriana The Java Modelling Language JML p.1/47 Lecture Plan 1. An Introduction to JML 2.
More informationJava Modelling Language (JML) References
Java Modelling Language (JML) References www.jmlspecs.org G. T. Leavens and Y. Cheon, Design by Contract with JML, August 2005. C. Marché, C. Paulin-Mohring, and X. Urbain, The Krakatoa Tool for Cerification
More informationIntroduction to JML David Cok, Joe Kiniry, and Erik Poll Eastman Kodak Company, University College Dublin, and Radboud University Nijmegen
Introduction to JML David Cok, Joe Kiniry, and Erik Poll Eastman Kodak Company, University College Dublin, and Radboud University Nijmegen David Cok, Joe Kiniry & Erik Poll - ESC/Java2 & JML Tutorial p.1/30
More informationCOMP 2355 Introduction to Systems Programming
COMP 2355 Introduction to Systems Programming Christian Grothoff christian@grothoff.org http://grothoff.org/christian/ 1 Today Class syntax, Constructors, Destructors Static methods Inheritance, Abstract
More informationCS24 Week 4 Lecture 2
CS24 Week 4 Lecture 2 Kyle Dewey Overview Linked Lists Stacks Queues Linked Lists Linked Lists Idea: have each chunk (called a node) keep track of both a list element and another chunk Need to keep track
More informationThe experimental guide: comparing automatic test generation with manual test generation from UML state machine diagrams of a vending machine program
The experimental guide: comparing automatic test generation with manual test generation from UML state machine diagrams of a vending machine program 1. Goal of the study The goal of this experiment is
More information1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.
1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered
More informationCSE 331 Midterm Exam Sample Solution 2/13/12
Question 1. (14 points) (assertions) Using backwards reasoning, find the weakest precondition for each sequence of statements and postcondition below. Insert appropriate assertions in each blank line.
More informationTesting and Debugging
Testing and Debugging Comp-303 : Programming Techniques Lecture 14 Alexandre Denault Computer Science McGill University Winter 2004 March 1, 2004 Lecture 14 Comp 303 : Testing and Debugging Page 1 Announcements...
More informationAdvances in Programming Languages
T O Y H Advances in Programming Languages APL4: JML The Java Modeling Language David Aspinall (slides originally by Ian Stark) School of Informatics The University of Edinburgh Thursday 21 January 2010
More informationTest-Driven Development (TDD)
Test-Driven Development (TDD) EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG DbC: Supplier DbC is supported natively in Eiffel for supplier: class ACCOUNT create make feature -- Attributes owner :
More informationAn Introduction To Software Agitation
An Introduction To Software Agitation Alberto Savoia Chief Technology Officer Agitar Software Inc. www.agitar.com java.sun.com/javaone/sf Agenda The Developer Testing Revolution Four Types of Tests Software
More informationChapter 1: Principles of Programming and Software Engineering
Chapter 1: Principles of Programming and Software Engineering Data Abstraction & Problem Solving with C++ Fifth Edition by Frank M. Carrano Software Engineering and Object-Oriented Design Coding without
More informationReproducing Crashes. Shifting Role of Testing. Shifting Role of Testing. Waterfall Model, V-Model
Reproducing Crashes Andreas Leitner Universität des Saarlandes 11.12.2008 1 Shifting Role of ing ing often ne towards release-time Modern development processes move testing to the center of development
More informationA Library-Based Approach to Translating OCL Constraints to JML Assertions for Runtime Checking
A Library-Based Approach to Translating OCL Constraints to JML Assertions for Runtime Checking Carmen Avila, Guillermo Flores, Jr., and Yoonsik Cheon TR #08-05 February 2008; revised May 2008 Keywords:
More informationDesign by Contract in Eiffel
Design by Contract in Eiffel 2002/04/15 ctchen@canthink.com.com.tw.tw Reference & Resource Bertrand Meyer, Object-Oriented Oriented Software Construction 2nd,, 1997, PH. Bertrand Meyer, Eiffel: The Language,,
More informationReferences: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1
References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1 Assertions Statements about input to a routine or state of a class Have two primary roles As documentation,
More informationUse the scantron sheet to enter the answer to questions (pages 1-6)
Use the scantron sheet to enter the answer to questions 1-100 (pages 1-6) Part I. Mark A for True, B for false. (1 point each) 1. Abstraction allow us to specify an object regardless of how the object
More informationSafely Creating Correct Subclasses without Seeing Superclass Code
Safely Creating Correct Subclasses without Seeing Superclass Code Clyde Ruby and Gary T. Leavens TR #00-05d April 2000, revised April, June, July 2000 Keywords: Downcalls, subclass, semantic fragile subclassing
More informationSyncFree SyncFree: The Development of an Open Source Personal Data Synchronization Software
SyncFree SyncFree: The Development of an Open Source Personal Data Synchronization Software {s1669021, s1598011, yccheng, hsieh}@ntut.edu.tw SyncFree Abstract People who use different computers at different
More informationAutomatic testing of object-oriented software
Automatic testing of object-oriented software Bertrand Meyer, Ilinca Ciupa, Andreas Leitner, Lisa (Ling) Liu Chair of Software Engineering, ETH Zurich, Switzerland http://se.ethz.ch {Firstname.Lastname}@inf.ethz.ch
More informationFormal Specification and Verification
Formal Specification and Verification Formal Specification, Part III Bernhard Beckert Adaptation of slides by Wolfgang Ahrendt Chalmers University, Gothenburg, Sweden Formal Specification and Verification:
More informationAssertions & Design-by-Contract using JML Erik Poll University of Nijmegen
Assertions & Design-by-Contract using JML Erik Poll University of Nijmegen Erik Poll - JML p.1/39 Overview Assertions Design-by-Contract for Java using JML Contracts and Inheritance Tools for JML Demo
More informationJava Modelling Language (JML) References
Java Modelling Language (JML) References G. T. Leavens and Y. Cheon. Design by Contract with JML, August 2005. L. Burdy, Y. Cheon, D. Cok, M. Ernst, J. Kiniry, G. T. Leavens, K. R. M. Leino, and E. Poll.
More informationControl flow in Eiffel
Announcements Assignment will be posted this week.» We ll make sure you have enough time to it! A little more Eiffel, Genericity and ADTs Week 3, Lecture 4 January 16 Section N Review What is the definition
More informationChapter 1: Programming Principles
Chapter 1: Programming Principles Object Oriented Analysis and Design Abstraction and information hiding Object oriented programming principles Unified Modeling Language Software life-cycle models Key
More informationJava-MOP: A Monitoring Oriented Programming Environment for Java
Java-MOP: A Monitoring Oriented Programming Environment for Java Feng Chen and Grigore Roşu Department of Computer Science, University of Illinois at Urbana - Champaign, USA {fengchen, grosu}@uiuc.edu
More informationReasoning about Object Structures Using Ownership
Reasoning about Object Structures Using Ownership Peter Müller ETH Zurich, Switzerland Peter.Mueller@inf.ethz.ch Abstract. Many well-established concepts of object-oriented programming work for individual
More informationCSC Advanced Object Oriented Programming, Spring Specification
CSC 520 - Advanced Object Oriented Programming, Spring 2018 Specification Specification A specification is an unambiguous description of the way the components of the software system should be used and
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationUniverse Type System for Eiffel. Annetta Schaad
Universe Type System for Eiffel Annetta Schaad Semester Project Report Software Component Technology Group Department of Computer Science ETH Zurich http://sct.inf.ethz.ch/ SS 2006 Supervised by: Dipl.-Ing.
More informationFormal Methods for Java
Formal Methods for Java Lecture 6: Introduction to JML Jochen Hoenicke Software Engineering Albert-Ludwigs-University Freiburg May 15, 2017 Jochen Hoenicke (Software Engineering) Formal Methods for Java
More informationChapter 15. Software Testing The assert Statement
177 Chapter 15 Software Testing We know that a clean compile does not imply that a program will work correctly. We can detect errors in our code as we interact with the executing program. The process of
More informationSafely Creating Correct Subclasses without Seeing Superclass Code
Safely Creating Correct Subclasses without Seeing Superclass Code Clyde Ruby and Gary T. Leavens Department of Computer Science Iowa State University 226 Atanasoff Hall, Ames, IA 50011 USA +1 515 294 1580
More informationDesign of a translation tool from OCL into JML by translating the iterate feature into Java methods [10, 11]
OCL JML Design of a translation tool from OCL into JML by translating the iterate feature into Java methods Summary. The paper presents design of a translation library from OCL (Object Constraint Language)
More informationPROCESS DEVELOPMENT METHODOLOGY The development process of an API fits the most fundamental iterative code development
INTRODUCING API DESIGN PRINCIPLES IN CS2 Jaime Niño Computer Science, University of New Orleans New Orleans, LA 70148 504-280-7362 jaime@cs.uno.edu ABSTRACT CS2 provides a great opportunity to teach an
More informationTowards Model-Driven Unit Testing
Towards Model-Driven Unit Testing Gregor Engels 1,2, Baris Güldali 1, and Marc Lohmann 2 1 Software Quality Lab 2 Department of Computer Science University of Paderborn, Warburgerstr. 100, 33098 Paderborn,
More informationMaster of Science in Embedded and Intelligent Systems MASTER THESIS. Generating Test Adapters for ModelJunit. Ardalan Hashemi Aghdam
Master of Science in Embedded and Intelligent Systems MASTER THESIS Generating Test Adapters for ModelJunit Ardalan Hashemi Aghdam Halmstad University, June 2017 Ardalan Hashemi Aghdam: Generating Test
More informationSymbolic Execution and Proof of Properties
Chapter 7 Symbolic Execution and Proof of Properties Symbolic execution builds predicates that characterize the conditions under which execution paths can be taken and the effect of the execution on program
More informationCsci 102: Sample Exam
Csci 102: Sample Exam Duration: 65 minutes Name: NetID: Student to your left: Student to your right: DO NOT OPEN THIS EXAM UNTIL INSTRUCTED Instructions: Write your full name and your NetID on the front
More informationSoftware Architectures
Software Architectures 2 SWS Lecture 1 SWS Lab Classes Hans-Werner Sehring Miguel Garcia Arbeitsbereich Softwaresysteme (STS) TU Hamburg-Harburg HW.Sehring@tuhh.de Miguel.Garcia@tuhh.de http://www.sts.tu-harburg.de/teaching/ss-05/swarch/entry.html
More informationProgram Correctness and Efficiency. Chapter 2
Program Correctness and Efficiency Chapter 2 Chapter Objectives To understand the differences between the three categories of program errors To understand the effect of an uncaught exception and why you
More informationAn Approach to Software Component Specification
Page 1 of 5 An Approach to Software Component Specification Jun Han Peninsula School of Computing and Information Technology Monash University, Melbourne, Australia Abstract. Current models for software
More informationPractical Application of a Translation Tool from UML/OCL to Java Skeleton with JML Annotation
Title Author(s) Practical Application of a Translation Tool from UML/OCL to Java Skeleton with JML Annotation Hanada, Kentaro; Okano, Kozo; Kusumoto, Shinji; Miyazawa, Kiyoyuki Citation Issue Date 2012
More informationEiffel as a Framework for Verification
Eiffel as a Framework for Verification Bertrand Meyer ETH Zurich http://se.inf.ethz.ch Eiffel Software www.eiffel.com Abstract. The Eiffel method and language integrate a number of ideas originating from
More information