JET

edu.utep.cs.jet.rat
Class TestCaseGenerator

java.lang.Object
  extended by edu.utep.cs.jet.rat.TestCaseGenerator
Direct Known Subclasses:
IncrementalRandomTestCaseGenerator

public abstract class TestCaseGenerator
extends Object

An abstract class to define the public interface for test case generation and execution. This class also implements the Observer design pattern to let the user observe test cases and test results. For this, it provides an interface for a test case generation listener (TestCaseGenerationListener) to register itself.

Version:
$Revision: 1.15 $
Author:
Yoonsik Cheon

Constructor Summary
protected TestCaseGenerator()
          Constructs an object for generating test cases.
 
Method Summary
 void addTestCaseGenerationListener(TestCaseGenerationListener l)
          Adds the given observer to the list of listeners.
abstract  void generate(Context ctx)
          Generates test cases under the given testing context.
static TestCaseGenerator getInstance(String strategy)
          Returns a test case generator of the given strategy.
protected  void notifyFailure(TestCase tc, String msg)
          Notifies a failure test case generation to the listeners.
protected  void notifyMeaningless(TestCase tc)
          Notifies a meaningless test case generation to the listeners.
protected  void notifyRedundant(TestCase tc)
          Notifies a duplicate test case generation to the listeners.
protected  void notifySuccess(TestCase tc)
          Notifies a success test case generation to the listeners.
 void removeTestCaseGenerationListener(TestCaseGenerationListener l)
          Removes the given observer from the list of listeners.
protected  void reset(Context context)
          Resets this object to generate test cases under the given testing context.
abstract  Iterable<TestCase> testcases()
          Returns an iterator that iterates over the generated test cases.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestCaseGenerator

protected TestCaseGenerator()
Constructs an object for generating test cases.

Method Detail

getInstance

public static TestCaseGenerator getInstance(String strategy)
Returns a test case generator of the given strategy. If the given strategy is unknown, then returns a null. Currently, two strategies are supported: random and irandom (incremental random).


generate

public abstract void generate(Context ctx)
Generates test cases under the given testing context. Whenever a new test case is generated, this method notifies all the currenly registered listeners. The generated test cases can also be obtained by calling the iterator testcases().


testcases

public abstract Iterable<TestCase> testcases()
Returns an iterator that iterates over the generated test cases.


reset

protected void reset(Context context)
Resets this object to generate test cases under the given testing context.


addTestCaseGenerationListener

public void addTestCaseGenerationListener(TestCaseGenerationListener l)
Adds the given observer to the list of listeners.


removeTestCaseGenerationListener

public void removeTestCaseGenerationListener(TestCaseGenerationListener l)
Removes the given observer from the list of listeners.


notifySuccess

protected void notifySuccess(TestCase tc)
Notifies a success test case generation to the listeners. A success test case is a test case that satisfies the postcondition of the method being tested.


notifyFailure

protected void notifyFailure(TestCase tc,
                             String msg)
Notifies a failure test case generation to the listeners. A failure test case is a test case that doesn't satisfy the postcondition of the method being tested.


notifyMeaningless

protected void notifyMeaningless(TestCase tc)
Notifies a meaningless test case generation to the listeners. A meaningless test case is a test case that doesn't satisfies the precondition of the method being tested.


notifyRedundant

protected void notifyRedundant(TestCase tc)
Notifies a duplicate test case generation to the listeners. A test case is redundant if there exists an equivalent test case in the test suite.


JET

JET is Copyright (C) 2005-2008 by The University of Texas at El Paso and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.