ps3.test
Class ScriptFileTests

java.lang.Object
  extended by ps3.test.ScriptFileTests

public class ScriptFileTests
extends Object

This class, along with a complete PS3TestDriver implementation, can be used to test the your implementations of Graph and the path finding algorithm using the script file format described in the problem set. It is assumed that the files are located in the same directory as this class. It works by parameterizing test methods over some data values, and then creating an instance for the cross-product of test methods and data values. In this case, it will create one ScriptFileTests instance per .expected file, and for each of those it will run the checkAgainstExpectedOutput() test. See the JUnit4 Javadocs for more information, or Google for more examples.


Constructor Summary
ScriptFileTests(File testScriptFile)
          This constructor is reflectively called by the Parameterized runner.
 
Method Summary
static void calculateTestFiles()
          This method searches for and creates file handles for each script test.
 void checkAgainstExpectedOutput()
          The only test that is run: run a script file and test its output.
static List<Object[]> getTestFiles()
          This method is called in the constructor of Parameterized.
static List<String> getTestLabels()
          
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptFileTests

public ScriptFileTests(File testScriptFile)
This constructor is reflectively called by the Parameterized runner. It creates a script file test instance, representing one script file to be tested.

Method Detail

calculateTestFiles

public static void calculateTestFiles()
This method searches for and creates file handles for each script test. It only searches the immediate directory where the ScriptFileTests.class classfile is located.


getTestFiles

public static List<Object[]> getTestFiles()
This method is called in the constructor of Parameterized.

Returns:
List of argument arrays that should be invoked on the ScriptFileTests constructor by the Parameterized test runner. Since that runner's constructor has one parameter, the array only has one element.

getTestLabels

This method is called in the constructor of LabelledParameterized. Since getTestFiles (and thus calculateTestFiles()) should have already been called by the Parameterized constructor, the test script names should already have been computed.

Returns:
List of labels to be used as names for each of the parameterized tests. These names are the same as the script file used to run the test.

checkAgainstExpectedOutput

public void checkAgainstExpectedOutput()
                                throws IOException
The only test that is run: run a script file and test its output.

Throws:
IOException