Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.simscomputing.testbed
Class TestCaseCollection  view TestCaseCollection download TestCaseCollection.java

java.lang.Object
  extended bycom.simscomputing.testbed.TestCaseCollection
Direct Known Subclasses:
ClearBoxTest, DirectoryTester, FileSystemTestCaseCollection, FileTester, StreamTestCollection

public class TestCaseCollection
extends java.lang.Object

Users of the Test Bed typically subclass this class and put their test cases in the subclass. Of special note are the setupCollection(), teardownCollection(), setup(), and teardown() methods. The first is called before any test cases in a Collection class are exercised. The second is called after all such test cases are exercised. Finally, setup() and teardown() are called before and after each test case.

These methods allow the programmer to perform initialization and cleanup.

Version:
$Revision: 1.1.1.1.2.1 $ $Date: 2000/03/31 18:23:31 $

Field Summary
private  java.util.ArrayList filtered
          Method names of test cases that are marked for execution.
private  java.util.ArrayList marked
           
private  java.util.List relatedTestCaseCollections
           
private  boolean stopped
           
static java.lang.String TEST_CASE_PREFIX
          The prefix for method names that represent test cases.
private  java.lang.StringBuffer testCaseInProgress
           
 
Constructor Summary
TestCaseCollection()
           
 
Method Summary
 void addTestCaseCollection(TestCaseCollection testCaseCollection)
          Adds a new TestCaseCollection to the list of related TestCaseCollections for this particular TestCaseCollection.
static void assert(boolean condition, java.lang.String message)
           
 void clearMarkedMethods()
           
private  int examineMethods(boolean runNow, TestResultCollection testResultCollection, TesterListener exerciseListener, int totalTests)
           
 TestResultCollection exercise(boolean runNow, TesterListener exerciseListener)
           
 TestResultCollection exercise(boolean runNow, TesterListener exerciseListener, TestResultCollection r, int methodCount)
          Exercises the TestCaseCollection.
protected  void exerciseTestCase(boolean runNow, java.lang.reflect.Method testCaseMethod, TestResultCollection testResultCollection, TesterListener exerciseListener, int testedSoFar, int totalTests, TestCaseCollection exercisee)
          Exercises a single test case.
 java.lang.String getName()
           
 int getNumberOfTestCases()
          Returns the number of test cases in this Test Case Collection and all related Test Case Collections.
 java.util.List getRelatedTestCaseCollections()
          Returns a list of TestCaseCollection objects that are related to this TestCaseCollection.
protected  java.lang.reflect.Method[] getTestCaseMethods()
          Returns the relevant test case methods from this test case collection.
protected  boolean isMethodTestCase(java.lang.reflect.Method method)
          Determines whether the specified method has the proper signature for a test case.
 void logStdError(java.lang.String testCaseCollectionName, java.lang.String shortTestCaseName, java.io.ByteArrayOutputStream errStream)
          Called after each test case is run.
 void logStdOut(java.lang.String testCaseCollectionName, java.lang.String shortTestCaseName, java.io.ByteArrayOutputStream outStream)
          Called after each test case is run.
 void markForTesting(java.lang.String testCaseCollectionClassName, java.lang.String testCaseName)
           
private  void markRelated()
           
private  void markRelated(java.lang.String testCaseCollectionClassName, java.lang.String testCaseName)
           
 void reset()
           
 void setup()
          Called before each test case runs.
 void setupCollection()
          Called before any test case in a collection class runs.
 void stop()
           
 void teardown()
          Called after each test case runs.
 void teardownCollection()
          Called after all test cases in a collection class have run.
 boolean wasStopped()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEST_CASE_PREFIX

public static final java.lang.String TEST_CASE_PREFIX
The prefix for method names that represent test cases.

See Also:
Constant Field Values

relatedTestCaseCollections

private java.util.List relatedTestCaseCollections

filtered

private java.util.ArrayList filtered
Method names of test cases that are marked for execution.


marked

private java.util.ArrayList marked

testCaseInProgress

private java.lang.StringBuffer testCaseInProgress

stopped

private boolean stopped
Constructor Detail

TestCaseCollection

public TestCaseCollection()
Method Detail

getNumberOfTestCases

public int getNumberOfTestCases()
Returns the number of test cases in this Test Case Collection and all related Test Case Collections.


stop

public void stop()

wasStopped

public boolean wasStopped()

reset

public void reset()
           throws TesterException

exercise

public TestResultCollection exercise(boolean runNow,
                                     TesterListener exerciseListener)
                              throws TesterException

exercise

public TestResultCollection exercise(boolean runNow,
                                     TesterListener exerciseListener,
                                     TestResultCollection r,
                                     int methodCount)
                              throws TesterException
Exercises the TestCaseCollection. Progress is monitored via the optional TesterListener interface. Returns the results of the tests.


examineMethods

private int examineMethods(boolean runNow,
                           TestResultCollection testResultCollection,
                           TesterListener exerciseListener,
                           int totalTests)

getRelatedTestCaseCollections

public java.util.List getRelatedTestCaseCollections()
Returns a list of TestCaseCollection objects that are related to this TestCaseCollection. Several TestCaseCollection objects can be grouped together to form a kind of test suite.


addTestCaseCollection

public void addTestCaseCollection(TestCaseCollection testCaseCollection)
Adds a new TestCaseCollection to the list of related TestCaseCollections for this particular TestCaseCollection.


assert

public static void assert(boolean condition,
                          java.lang.String message)
                   throws TestFailedException

getName

public java.lang.String getName()

exerciseTestCase

protected void exerciseTestCase(boolean runNow,
                                java.lang.reflect.Method testCaseMethod,
                                TestResultCollection testResultCollection,
                                TesterListener exerciseListener,
                                int testedSoFar,
                                int totalTests,
                                TestCaseCollection exercisee)
Exercises a single test case.


isMethodTestCase

protected boolean isMethodTestCase(java.lang.reflect.Method method)
Determines whether the specified method has the proper signature for a test case.


getTestCaseMethods

protected java.lang.reflect.Method[] getTestCaseMethods()
Returns the relevant test case methods from this test case collection.


clearMarkedMethods

public void clearMarkedMethods()

markForTesting

public void markForTesting(java.lang.String testCaseCollectionClassName,
                           java.lang.String testCaseName)

markRelated

private void markRelated(java.lang.String testCaseCollectionClassName,
                         java.lang.String testCaseName)

markRelated

private void markRelated()

setup

public void setup()
Called before each test case runs.


teardown

public void teardown()
Called after each test case runs.


logStdOut

public void logStdOut(java.lang.String testCaseCollectionName,
                      java.lang.String shortTestCaseName,
                      java.io.ByteArrayOutputStream outStream)
Called after each test case is run. Allows the opertunity for a test case to log all standard output.


logStdError

public void logStdError(java.lang.String testCaseCollectionName,
                        java.lang.String shortTestCaseName,
                        java.io.ByteArrayOutputStream errStream)
Called after each test case is run. Allows the opertunity for a test case to log all standard error.


setupCollection

public void setupCollection()
Called before any test case in a collection class runs.


teardownCollection

public void teardownCollection()
Called after all test cases in a collection class have run.