korat - Korat: Automated Testing Based on Java Predicates...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Korat: Automated Testing Based on Java Predicates Chandrasekhar Boyapati, Sarfraz Khurshid, and Darko Marinov MIT Laboratory for Computer Science 200 Technology Square Cambridge, MA 02139 USA { chandra,khurshid,marinov } @lcs.mit.edu ABSTRACT This paper presents Korat, a novel framework for automated testing of Java programs. Given a formal speciFcation for a method, Korat uses the method precondition to automatically generate all (noni- somorphic) test cases up to a given small size. Korat then executes the method on each test case, and uses the method postcondition as a test oracle to check the correctness of each output. To generate test cases for a method, Korat constructs a Java predi- cate (i.e., a method that returns a boolean) from the method’s pre- condition. The heart of Korat is a technique for automatic test case generation: given a predicate and a bound on the size of its inputs, Korat generates all (nonisomorphic) inputs for which the predicate returns true. Korat exhaustively explores the bounded input space of the predicate but does so efFciently by monitoring the predicate’s executions and pruning large portions of the search space. This paper illustrates the use of Korat for testing several data struc- tures, including some from the Java Collections ¡ramework. The experimental results show that it is feasible to generate test cases from Java predicates, even when the search space for inputs is very large. This paper also compares Korat with a testing framework based on declarative speciFcations. Contrary to our initial expec- tation, the experiments show that Korat generates test cases much faster than the declarative framework. 1. INTRODUCTION Manual software testing, in general, and test data generation, in particular, are labor-intensive processes. Automated testing can signiFcantly reduce the cost of software development and main- tenance [4]. This paper presents Korat, a novel framework for au- tomated testing of Java programs. Korat uses speciFcation-based testing [5, 13, 15, 25]. Given a formal speciFcation for a method, Korat uses the method precondition to automatically generate all nonisomorphic test cases up to a given small size. Korat then exe- cutes the method on each test case, and uses the method postcondi- tion as a test oracle to check the correctness of each output. To generate test cases for a method, Korat constructs a Java predi- cate (i.e., a method that returns a boolean) from the method’s pre- condition. One of the key contributions of Korat is a technique for automatic test case generation: given a predicate, and a bound on the size of its inputs, Korat generates all nonisomorphic inputs for which the predicate returns true . Korat uses backtracking to sys- tematically explore the bounded input space of the predicate. Korat generates candidate inputs and checks their validity by invoking the predicate on them. Korat monitors accesses that the predicate makes to all the Felds of the candidate input. If the predicate returnsmakes to all the Felds of the candidate input....
View Full Document

This note was uploaded on 10/04/2011 for the course CEN 5016 taught by Professor Workman,d during the Spring '08 term at University of Central Florida.

Page1 / 11

korat - Korat: Automated Testing Based on Java Predicates...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online