net.sourceforge.groboutils.junit.v1
Class SubTestTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sourceforge.groboutils.junit.v1.SubTestTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
IntegrationTestCase

public class SubTestTestCase
extends junit.framework.TestCase

A TestCase which enables tests to run a subset of tests from an active test. Examples would include running unit tests associated with an object returned from a creation method called on the class under test.

Note that added sub-tests should be new Test instances, not the same test. This is because these sub-tests will run after the registered instance has tearDown() called on it.

Since:
July 26, 2002
Version:
$Date: 2003/02/10 22:52:19 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
SubTestTestCase()
          Default constructor that uses the JUnit 3.8 version of setName() for setting the test's name.
SubTestTestCase(java.lang.String name)
          Creates a new test case with the given name.
 
Method Summary
 void addSubTest(junit.framework.Test test)
          Allows for execution of the given test instance from inside another test.
 void run(junit.framework.TestResult result)
          Runs the test case and collects the results in TestResult.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubTestTestCase

public SubTestTestCase(java.lang.String name)
Creates a new test case with the given name. This allows for JUnit 3.7 compatibility.


SubTestTestCase

public SubTestTestCase()
Default constructor that uses the JUnit 3.8 version of setName() for setting the test's name.

Since:
December 28, 2002
Method Detail

addSubTest

public void addSubTest(junit.framework.Test test)
Allows for execution of the given test instance from inside another test. This will use the current test's TestResult, or if there is no current TestResult, it will create a new one for the test. Note that the list of tests will be run at the end of the current test, after the tearDown() method has been called. This is for legacy TestListener support.

Parameters:
test - the test object to add as a sub-test.

run

public void run(junit.framework.TestResult result)
Runs the test case and collects the results in TestResult.



Copyright © 2001-2003 by The GroboUtils Project