Package org.castor.xmlctf
Class CastorTestCase
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.castor.xmlctf.CastorTestCase
-
- All Implemented Interfaces:
junit.framework.Test
public class CastorTestCase extends junit.framework.TestCase
Abstracts a test case in the CTF (Castor Test Framework). A CTF test case can be driven by a directory or by a JAR file.- Version:
- $Revision: 6787 $ $Date: 2004-03-08 17:23:25 -0700 (Mon, 08 Mar 2004) $
- Author:
- Arnaud Blandin
-
-
Field Summary
Fields Modifier and Type Field Description static short
DIRECTORY
A directory-based Castor test case.static short
JAR
A JAR-based Castor test case.static java.lang.String
TEST_DESCRIPTOR
Name of the resource for the test descriptor XML document.static short
UNKNOWN
An unknown type of Castor test case.
-
Constructor Summary
Constructors Constructor Description CastorTestCase(java.io.File file, java.lang.String directoryToHere, java.lang.String outputRoot)
Constructs a CTF test case given a File (either a JAR file or a directory) and a directory where temporary files will be placed.CastorTestCase(java.lang.String name)
Constructs a CTF test case given only a test case name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassLoader
getClassLoader()
java.lang.String
getDirectoryToHere()
java.io.File
getOutputRootFile()
java.io.File
getTestFile()
short
getType()
boolean
isDirectoryCompiled()
Returns a boolean that when true indicates the output directory has been compiled.void
setClassLoader(java.lang.ClassLoader loader)
Sets the ClassLoader to use for loading the resources for this test case.void
setDirectoryCompiled(boolean compiled)
Sets a flag to indicate the output directory has been compiled.junit.framework.Test
suite()
Assembles and returns a test suite containing all known tests.-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
-
-
-
-
Field Detail
-
UNKNOWN
public static final short UNKNOWN
An unknown type of Castor test case.- See Also:
- Constant Field Values
-
DIRECTORY
public static final short DIRECTORY
A directory-based Castor test case.- See Also:
- Constant Field Values
-
JAR
public static final short JAR
A JAR-based Castor test case.- See Also:
- Constant Field Values
-
TEST_DESCRIPTOR
public static final java.lang.String TEST_DESCRIPTOR
Name of the resource for the test descriptor XML document.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CastorTestCase
public CastorTestCase(java.lang.String name)
Constructs a CTF test case given only a test case name.- Parameters:
name
- the name of the test case
-
CastorTestCase
public CastorTestCase(java.io.File file, java.lang.String directoryToHere, java.lang.String outputRoot)
Constructs a CTF test case given a File (either a JAR file or a directory) and a directory where temporary files will be placed. The test case name will be derived from the file (JAR or directory) name.- Parameters:
file
- Either a directory containing TestDescriptor.xml or a JAR file containing META-INF/TestDescriptor.xmldirectoryToHere
- directory path leading to the current test.outputRoot
- Directory where temporary files and output will go.
-
-
Method Detail
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
-
getTestFile
public java.io.File getTestFile()
-
getType
public short getType()
-
getDirectoryToHere
public java.lang.String getDirectoryToHere()
-
getOutputRootFile
public java.io.File getOutputRootFile()
-
isDirectoryCompiled
public boolean isDirectoryCompiled()
Returns a boolean that when true indicates the output directory has been compiled. This is useful for preventing the compilation of a directory multiple times when more than one test case exists in a given directory.- Returns:
- true when the output root directory has already been compiled.
-
setClassLoader
public void setClassLoader(java.lang.ClassLoader loader)
Sets the ClassLoader to use for loading the resources for this test case.- Parameters:
loader
- the class loader to use
-
setDirectoryCompiled
public void setDirectoryCompiled(boolean compiled)
Sets a flag to indicate the output directory has been compiled. This prevents compiling a directory multiple times unnecessarily when more than one test case exists in a given directory.- Parameters:
compiled
- true if the output directory for this test case has been compiled
-
suite
public junit.framework.Test suite()
Assembles and returns a test suite containing all known tests.- Returns:
- A non-null test suite if we can load the test descriptor
-
-