org.foray.app.test
Class TestConverter

java.lang.Object
  extended by org.foray.app.test.TestConverter

public class TestConverter
extends Object

TestConverter is used to process a set of tests specified in a testsuite. This class retrieves the data in the testsuite and uses FOray to convert the xml and xsl file into either an xml representation of the area tree or a pdf document. The area tree can be used for automatic comparisons between different versions of FOray or the pdf can be view for manual checking and pdf rendering.


Constructor Summary
TestConverter()
          Constructor.
 
Method Summary
protected  Node locateResult(Node testcase, String id)
          Find and return the result node.
static void main(String[] args)
          This main method can be used to run the test converter from the command line.
protected  void runTest(Node testcase, Node test)
          Run a particular test.
protected  void runTestCase(Node tcase)
          Run a test case.
 Map<String,Boolean> runTests(String fname, String dest)
          Run the Tests.
 void setBaseDir(String str)
          Sets the base directory to be used.
 void setFailOnly(boolean fail)
          Sets the fail only flag.
 void setOutputPDF(boolean pdf)
          Sets the flag indicating whether the output should be to PDF or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestConverter

public TestConverter()
Constructor.

Method Detail

main

public static void main(String[] args)
This main method can be used to run the test converter from the command line. This will take a specified testsuite xml and process all tests in it.

Parameters:
args - The command line options, which are: -b to set the base directory for where the testsuite and associated files are -failOnly to process only the tests which are specified as fail in the test results -pdf to output the result as pdf

setOutputPDF

public void setOutputPDF(boolean pdf)
Sets the flag indicating whether the output should be to PDF or not.

Parameters:
pdf - The new flag value.

setFailOnly

public void setFailOnly(boolean fail)
Sets the fail only flag.

Parameters:
fail - The new flag value.

setBaseDir

public void setBaseDir(String str)
Sets the base directory to be used.

Parameters:
str - The new base directory.

runTests

public Map<String,Boolean> runTests(String fname,
                                    String dest)
                             throws FOrayException
Run the Tests. This runs the tests specified in the xml file fname. The document is read as a dom and each testcase is covered.

Parameters:
fname - The name of the file containing the tests to be run.
dest - The name of the directory (relative to the base directory) into which the output should be placed.
Returns:
The map of results.
Throws:
FOrayException - For errors processing the tests.

runTestCase

protected void runTestCase(Node tcase)
                    throws FOrayException
Run a test case. This goes through a test case in the document. A testcase can contain a test, a result or more test cases. A test case is handled recursively otherwise the test is run.

Parameters:
tcase - The testcase node.
Throws:
FOrayException - For errors processing the test.

runTest

protected void runTest(Node testcase,
                       Node test)
                throws FOrayException
Run a particular test. This runs a test defined by the xml and xsl documents. If the test has a result specified it is checked. This creates an XSLTInputHandler to provide the input for FOray and writes the data out to an XML area tree.

Parameters:
testcase - The test case node.
test - The test node.
Throws:
FOrayException - For errors processing the test.

locateResult

protected Node locateResult(Node testcase,
                            String id)
Find and return the result node.

Parameters:
testcase - The testcase node being tested.
id - The id of the result node.
Returns:
The result node.


Copyright © 2017. All rights reserved.