:: End of manually writing unit tests. Why not generate test cases automatically and smartly?

CUTE :: A Concolic Unit Testing Engine for C and Java

Open System Laboratory | Computer Science Department | University of Illinois at Urbana Champaign

Download

CUTE for C can be downloaded here.

Requirement

windows 2000, XP with cygwin or linux
gcc compiler
bash shell

Installation

tar zxvf cute.tar.gz
cd cute
./setup

also include cute in PATH

Micro Tutorial

A micro tutorial on how to use CUTE can be found here.

Usage

cutec is the instrumentor plus compiler script for programs under test.

cute is the script to concolically test the executable of the instrumented program under test.

usage: cutec program entryfunction
program is the name of the program under test. entryfunction is the name of the function to be tested. It should not have any parameters. All inputs to a program must be specified using CUTE_input and CUTE_array_input macros.

usage: cute program -i n [-d depth=0] [-s seed] [-m mode=0] [-r] [-p] [-q]
 -i iterations : iterations is the maximum number of times to concolically execute program.
 -d depth : Depth of bounded depth-first search. Default is 0, which implies infinite depth.
 -s seed : seed used to initialize random number generator if -r option is given. 
 -m mode : Default is 0.
        0 - explore next path in concolic testing.
        1 - replay last execution path with no concolic execution.
        2 - restart concolic testing.
 -r : if -r is specified, then inputs are randomly initialized; else, inputs are set to 0.
      Pointers are initialized to NULL in either cases.
 -p : Random search strategy is invoked.
 -q : if -q is specified, then coverage statistics are recorded during testing.

Cute Includes

One can include cute.h in a program to use the following four useful macros:
  1. CUTE_input(x), allows user to specify that the variable x (of any type, including a pointer) is an input, in addition to the arguments of the entry function. This comes handy to replace any external user input, e.g., scanf("%d",&v) CUTE_input(v) (which also assigns value to &v). If x is of a pointer type, CUTE assumes that x points to a single memory cell.
  2. CUTE_array_input(p,sz): This macro is similar to CUTE_input except that it assumes that p is a pointer and specifies that p points to an array of size sz instead of a single cell.
  3. CUTE_assume(pred), where pred is some C predicate. This macro allows the execution to proceed if the pred holds. This way we can restrict the input, e.g., the predicate can be a repOk() call for some data structure.
  4. CUTE_assert(pred): This macro specifies an assertion whose violation is considered an error.
Copyright © 2006 University of Illinois at Urbana Champaign. All rights Reserved