|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.TestSuite
junitutils.TestFilesTestSuite
This is a JUnit TestSuite that is created from a number of tests as follows. Each TestCase is an instance of the inner class Helper, instantiated with a name of a file. The file names are read from the file named by the parameter 'fileOfTestFilenames'. The argument to the constructor named 'args' provides a set of command-line arguments; the filename for the TestCase is added on to the end of the list of command-line arguments. Then the static compile method of the given class is called on those command-line arguments.
The standard output and error output is captured from the execution of the compile method. This is compared to the output in filename + "-expected". The TestCase succeeds if these match; if they do not match, the test fails and the actual output is saved in filename + "-ckd".
The test must be run from the directory in which it resides - because it creates and opens files in the current directory.
Nested Class Summary | |
class |
TestFilesTestSuite.Helper
This is a helper class that is actually a TestCase; it is run repeatedly with different constructor arguments. |
Field Summary | |
protected java.lang.reflect.Method |
method
The method that is to be executed on the command-line arguments. |
(package private) static java.lang.String |
ORACLE_SUFFIX
|
(package private) static java.lang.String |
SAVED_SUFFIX
|
protected java.lang.String |
testName
The name of this test suite. |
Fields inherited from class junit.framework.TestSuite |
|
Constructor Summary | |
protected |
TestFilesTestSuite()
|
|
TestFilesTestSuite(java.lang.String testName,
java.lang.String fileOfTestFilenames,
java.lang.String[] args,
java.lang.Class cls)
A constructor for this test suite. |
Method Summary | |
java.lang.String |
checkReturnValue(java.lang.String fileToTest,
java.lang.String expectedOutput,
java.lang.Object returnedValue)
|
protected java.lang.String |
doOutputCheck(java.lang.String fileToTest,
java.lang.String output,
java.lang.Object returnedValue)
|
protected java.lang.Object |
dotest(java.lang.String fileToTest,
java.lang.String[] args)
This is the actual test; it compiles the given file and compares its output to the expected result (in fileToTest+ORACLE_SUFFIX); the output is expected to match and the result of the compile to be true or false, depending on whether errors or warnings were reported. |
boolean |
expectedBooleanStatus(java.lang.String fileToTest,
java.lang.String expectedOutput)
|
int |
expectedIntegerStatus(java.lang.String fileToTest,
java.lang.String expectedOutput)
|
java.lang.String |
expectedStatusReport(java.lang.String fileToTest,
boolean b,
java.lang.String expectedOutput)
|
java.lang.String |
expectedStatusReport(java.lang.String fileToTest,
int ecode,
java.lang.String expectedOutput)
Returns null if ok, otherwise returns failure message. |
protected TestFilesTestSuite.Helper |
makeHelper(java.lang.String filename,
java.lang.String[] args)
Factory method for the helper class object. |
Methods inherited from class junit.framework.TestSuite |
addTest, addTestSuite, countTestCases, createTest, getName, getTestConstructor, run, runTest, setName, testAt, testCount, tests, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String testName
protected java.lang.reflect.Method method
static final java.lang.String SAVED_SUFFIX
static final java.lang.String ORACLE_SUFFIX
Constructor Detail |
protected TestFilesTestSuite()
public TestFilesTestSuite(java.lang.String testName, java.lang.String fileOfTestFilenames, java.lang.String[] args, java.lang.Class cls)
testName
- The name of the test suitefileOfTestFilenames
- The file to be read for filenames of testsargs
- The command-line arguments that the static compile
method will be applied to, with the filename added oncls
- The class in which to find the static compile methodMethod Detail |
protected TestFilesTestSuite.Helper makeHelper(java.lang.String filename, java.lang.String[] args)
protected java.lang.Object dotest(java.lang.String fileToTest, java.lang.String[] args) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
protected java.lang.String doOutputCheck(java.lang.String fileToTest, java.lang.String output, java.lang.Object returnedValue)
public java.lang.String checkReturnValue(java.lang.String fileToTest, java.lang.String expectedOutput, java.lang.Object returnedValue)
public java.lang.String expectedStatusReport(java.lang.String fileToTest, int ecode, java.lang.String expectedOutput)
public java.lang.String expectedStatusReport(java.lang.String fileToTest, boolean b, java.lang.String expectedOutput)
public boolean expectedBooleanStatus(java.lang.String fileToTest, java.lang.String expectedOutput)
public int expectedIntegerStatus(java.lang.String fileToTest, java.lang.String expectedOutput)
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |