com.dtrules.testsupport
Interface ITestHarness

All Known Implementing Classes:
ATestHarness

public interface ITestHarness

Author:
ps24876

Method Summary
 void changeReportXML(OutputStream report)
          Generate a change report xml to the given output stream.
 String compareNodes(XMLTree.Node thisResult, XMLTree.Node oldResult)
          Once the two XML results are returned, this test is used to check if they are the same.
 void compareTestResults()
          Compare our new results with a set of past result files.
 PrintStream compareTestResultsReport()
          When we compare the results of one run of a set of tests against another, this is where we write the report.
 boolean Console()
          Do you want to print the report data to the Console as well as to the report file?
 boolean coverageReport()
          If true, and trace files are produced, then a coverage report will be generated.
 String entrypoint()
          AutoDataMap Support Returns the entry point into the Rule Set.
 void executeDecisionTables(IRSession session)
          Called to execute the Decision Tables.
 String getCurrentFile()
          Returns the filename of the test set currently under test.
 DataMap getDataMap()
           
 String getDecisionTableName()
          This is the name of the Decision Table that has to be executed to evaluate a data set against this rule set.
 String[] getDecisionTableNames()
          Get a list of decision tables to execute.
 File[] getFiles()
          Returns the set of files to run as part of the test, in the order provided.
 String getOutputDirectory()
          This is where we are going to put the trace files, report files, etc.
 String getPath()
          Returns the path to the Project Directory under which we organize the test files, defined the Rule Sets, etc. for this project.
 String getReportFileName()
          The name of the report file.
 String getResultDirectory()
          This is where we are going to look for past results to compare our new results to.
 String getRulesDirectoryFile()
          Defines the Rules Directory for this RuleSet.
 String getRulesDirectoryPath()
          Get the path to the Rules Directory Control File.
 String getRuleSetName()
          Defines the name of the RuleSet we are testing
 String getTestDirectory()
          Specifies a directory of test files.
 int harnessVersion()
          Returns the TestHarness Version.
 void loadData(IRSession session, String path, String dataset)
          Provides a way for a project to manage how data is loaded into a session.
 String mapName()
          AutoDataMap Support Returns the map file name for this test.
 boolean numbered()
          If true, then the files generated will have a number attached to them.
 void printReport(int runNumber, IRSession session, PrintStream out)
          Print reports; Since the test harness can run multiple tests, the number of the test having been run is passed down to printReport.
 String referencePath()
          Path to the Alternate Configuration File (generally the deployed rule set) to use as a basis to produce a change report XML
 String referenceRulesDirectoryFile()
          Alternate Configuration File (generally the deployed rule set) to use as a basis to produce a change report XML
 void runTests()
          Runs all the test files in the TestDirectory;
 boolean Trace()
          If you want to trace a run, this function should return true;
 boolean Verbose()
          If verbose, we are going to print the EDD before we run the rules as well as after we run the rules.
 

Method Detail

harnessVersion

int harnessVersion()
Returns the TestHarness Version. At this point we have the following versions:

1 -- Use the dataMap interface 2 -- Use the autoDataMap interface

Returns:

entrypoint

String entrypoint()
AutoDataMap Support Returns the entry point into the Rule Set.

Returns:

mapName

String mapName()
AutoDataMap Support Returns the map file name for this test.

Returns:

getPath

String getPath()
Returns the path to the Project Directory under which we organize the test files, defined the Rule Sets, etc. for this project.

Returns:

getRulesDirectoryPath

String getRulesDirectoryPath()
Get the path to the Rules Directory Control File.


getRulesDirectoryFile

String getRulesDirectoryFile()
Defines the Rules Directory for this RuleSet. Generally it will be named "DTRules.xml" and located in the xml directory. But not always, depending on how Rules are deployed.

Returns:

getDecisionTableName

String getDecisionTableName()
This is the name of the Decision Table that has to be executed to evaluate a data set against this rule set.

Returns:

getDecisionTableNames

String[] getDecisionTableNames()
Get a list of decision tables to execute.

Returns:

getRuleSetName

String getRuleSetName()
Defines the name of the RuleSet we are testing


executeDecisionTables

void executeDecisionTables(IRSession session)
                           throws RulesException
Called to execute the Decision Tables. Some Test Harnesses might need to make multiple Decision Table Calls

Throws:
RulesException

getTestDirectory

String getTestDirectory()
Specifies a directory of test files. Directories or files that are not .xml files are ignored. Each test file is executed, and a report entry is made in the report file.

Returns:

getOutputDirectory

String getOutputDirectory()
This is where we are going to put the trace files, report files, etc.

Returns:

getResultDirectory

String getResultDirectory()
This is where we are going to look for past results to compare our new results to.

Returns:

Console

boolean Console()
Do you want to print the report data to the Console as well as to the report file? If so, this method should return true.

Returns:

Verbose

boolean Verbose()
If verbose, we are going to print the EDD before we run the rules as well as after we run the rules.

Returns:

numbered

boolean numbered()
If true, then the files generated will have a number attached to them. This is important if the test run will execute a set of files multiple times, and for whatever reason, you want all the results and traces of each run.


Trace

boolean Trace()
If you want to trace a run, this function should return true;

Returns:

loadData

void loadData(IRSession session,
              String path,
              String dataset)
              throws Exception
Provides a way for a project to manage how data is loaded into a session.

Parameters:
session -
path -
dataset -
Throws:
Exception

getReportFileName

String getReportFileName()
The name of the report file.

Returns:

runTests

void runTests()
Runs all the test files in the TestDirectory;


compareNodes

String compareNodes(XMLTree.Node thisResult,
                    XMLTree.Node oldResult)
Once the two XML results are returned, this test is used to check if they are the same. If the two nodes are equal, this method must return a null. Anything else will be interpreted as being different, and the String will be used to report that difference.

Parameters:
thisResult -
oldResult -
Returns:
null if the nodes are equal, or a String detailing the differences if the Nodes are not the same.

compareTestResultsReport

PrintStream compareTestResultsReport()
                                     throws Exception
When we compare the results of one run of a set of tests against another, this is where we write the report.

Returns:
Throws:
Exception

compareTestResults

void compareTestResults()
                        throws Exception
Compare our new results with a set of past result files.

Throws:
Exception

printReport

void printReport(int runNumber,
                 IRSession session,
                 PrintStream out)
                 throws Exception
Print reports; Since the test harness can run multiple tests, the number of the test having been run is passed down to printReport. That way, if it needs to print additional reports or results, it can tag them with the appropriate run number

Parameters:
runNumber - the number of the test being run
session - the session of the Rules Engine to use as the basis of the report
the - result file opened by the TestHarness... Most tests need one, so we open one for you.
Throws:
Exception

getDataMap

DataMap getDataMap()

referenceRulesDirectoryFile

String referenceRulesDirectoryFile()
Alternate Configuration File (generally the deployed rule set) to use as a basis to produce a change report XML

Returns:

referencePath

String referencePath()
Path to the Alternate Configuration File (generally the deployed rule set) to use as a basis to produce a change report XML

Returns:

changeReportXML

void changeReportXML(OutputStream report)
Generate a change report xml to the given output stream.

Parameters:
report -

coverageReport

boolean coverageReport()
If true, and trace files are produced, then a coverage report will be generated.

Returns:

getCurrentFile

String getCurrentFile()
Returns the filename of the test set currently under test.

Returns:

getFiles

File[] getFiles()
Returns the set of files to run as part of the test, in the order provided. By overriding this method, a test routine can be written to avoid certain files, repeat the execution of files, or run files in a different order.

Returns:


Copyright © 2011 DTrules Inc. All Rights Reserved.