Table of Contents

CyTest is dead - long live CyCoTest - The Curry Coverage Tester!

information on this page is deprecated.

CyTest

CyTest is a tool for the systematic generation of glass-box test cases for Curry programs. It is based on the ideas described in this paper.

Installation

There is a prototypical implementation based on the Curry system KiCS. You can download it or fetch the latest version using the revision control system git:

$ git clone http://www-ps.informatik.uni-kiel.de/~sebf/repos/cytest.git

To install CyTest,

  • go to the directory where you downloaded it,
  • type make install, and
  • follow the instructions on how to extend your .kicsrc file

When you have installed CyTest sucessfully, you should add the bin directory to your $PATH environment variable to be able to run cytest.sh from arbitrary directories.

Usage

For a quick start, go to the examples directory and look at the file reverse.curry:

reverse [] = []
reverse (x:xs) = reverse xs ++ [x]

It contains a naive implementation of the reverse function on lists. In order to be able to generate test cases for reverse you need to transform the program into another program that allows to collect coverage information during its execution. To do so type

$ cytest.sh reverse

You should see something like

 ,-----. ,--------.      ,--.
'  .--./. ,-.  .--'-.,--.'  '-.
|  |  \  '  /  | .-.(  .-.  .-'
'  '--'\   '|  |   -.-' `)  |
 `-----'  / `--'`---`----`--'
     `---'  Test Case Generator

transforming reverse..
up-to-date: Prelude_cytest

You have just generated a transformed program reverse_cytest.fcy which is stored in the lib directory of CyTest. The Prelude has already been transformed during the installation so it does not need to be transformed again.

The module reverse_cytest can be used to generate test cases w.r.t. different coverage criteria. Open your favorite editor and create a new module, e.g. reverseTests, with the following contents:

import CyTest
import reverse_cytest
import Prelude hiding ( reverse )

reverseTests :: [Int] -> IO ()
reverseTests = 
  cytest1 (iGlobal`withPostElimUI`summaryUI) ("reverse","reverse") reverse

The IO action reverseTests takes a nondeterministic generator as argument that generates test input for reverse. If you want to use arbitrary lists of integers as input to reverse, you can simply use a free variable as generator:

$ kicsi reverseTests
reverseTests> let xs free in reverseTests xs
...
reverse [0,0,0] = [0,0,0]
reverse [] = []

CyTest generates a number of test cases for reverse eliminates redundant tests w.r.t. global coverage information and prints the generated tests along with some other information as a summary. It may be unfortunate that the tool selects a list with equal elements. But as reverse does not touch the elements, this test is as good as any other with a list of three elements w.r.t code coverage.

This was a brief introduction on how to use CyTest. Until more information is available here, you may consider looking at src/CyTest.curry to figure out how to change the coverage criterion or the post processing of test cases.

/srv/dokuwiki/currywiki/data/pages/tools/cytest.txt · Last modified: 2014-06-13 12:35 by 127.0.0.1
Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0