org.aitools.programd.test.aiml
Class Tester

java.lang.Object
  extended by org.aitools.programd.test.aiml.Tester

public class Tester
extends java.lang.Object

A Tester loads one or more test suites and runs them, logging output.

Author:
Albertas Mickensas, Noel Bush

Field Summary
private  Core core
          The Core that this Tester will use.
private  java.util.LinkedList<TestResult> failures
          The test failures.
private  org.apache.log4j.Logger logger
          The logger to use.
private  Multiplexor multiplexor
          The Multiplexor that this Tester will use.
private  java.util.LinkedList<TestResult> successes
          The test successes.
private  java.util.HashMap<java.lang.String,TestSuite> suites
          The test suites.
private  java.util.List<java.net.URL> suiteURLs
          The pathspec for the test suites.
private static java.lang.String TEST_CASES_SCHEMA_LOCATION
          The location of the test cases schema.
private  java.net.URL testReportDirectory
          The path to the test report directory.
private static java.text.SimpleDateFormat timestampFormat
          The timestamp format to use for reports.
 
Constructor Summary
Tester(Core coreToUse, org.apache.log4j.Logger testLogger, java.util.List<java.net.URL> suitePaths, java.net.URL testReports)
          Creates a new Tester which will use the given Core to find out its configuration and run tests.
 
Method Summary
private static java.util.HashMap<java.lang.String,TestSuite> loadTests(java.util.List<java.net.URL> suiteList, java.net.URL schema, Multiplexor multiplexorToUse, org.apache.log4j.Logger logger)
          Loads all test suites from a given pathspec (may use wildcards).
 java.lang.String run(java.lang.String botid, java.lang.String suite, int runCount)
          Runs the tests in the given suite on the given botid, a given number of times.
private  void runAllSuites(java.lang.String botid, int runCount)
           
private  void runOneSuite(java.lang.String botid, java.lang.String suiteName, int runCount)
           
private  void runSuite(java.lang.String botId, TestSuite suite)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

suites

private java.util.HashMap<java.lang.String,TestSuite> suites
The test suites.


successes

private java.util.LinkedList<TestResult> successes
The test successes.


failures

private java.util.LinkedList<TestResult> failures
The test failures.


core

private Core core
The Core that this Tester will use.


multiplexor

private Multiplexor multiplexor
The Multiplexor that this Tester will use.


logger

private org.apache.log4j.Logger logger
The logger to use.


suiteURLs

private java.util.List<java.net.URL> suiteURLs
The pathspec for the test suites.


testReportDirectory

private java.net.URL testReportDirectory
The path to the test report directory.


timestampFormat

private static final java.text.SimpleDateFormat timestampFormat
The timestamp format to use for reports.


TEST_CASES_SCHEMA_LOCATION

private static final java.lang.String TEST_CASES_SCHEMA_LOCATION
The location of the test cases schema.

See Also:
Constant Field Values
Constructor Detail

Tester

public Tester(Core coreToUse,
              org.apache.log4j.Logger testLogger,
              java.util.List<java.net.URL> suitePaths,
              java.net.URL testReports)
Creates a new Tester which will use the given Core to find out its configuration and run tests.

Parameters:
coreToUse - the Core to use for finding plugin configuration, active multiplexor, etc.
testLogger - the logger to which to send output
suitePaths - the test suites
testReports - the directory in which to store test reports
Method Detail

run

public java.lang.String run(java.lang.String botid,
                            java.lang.String suite,
                            int runCount)
Runs the tests in the given suite on the given botid, a given number of times.

Parameters:
suite - the suite to run
botid - the botid on whom to run the tests
runCount - the number of times to run the tests
Returns:
the path where the test report was written

runOneSuite

private void runOneSuite(java.lang.String botid,
                         java.lang.String suiteName,
                         int runCount)

runAllSuites

private void runAllSuites(java.lang.String botid,
                          int runCount)

runSuite

private void runSuite(java.lang.String botId,
                      TestSuite suite)

loadTests

private static java.util.HashMap<java.lang.String,TestSuite> loadTests(java.util.List<java.net.URL> suiteList,
                                                                       java.net.URL schema,
                                                                       Multiplexor multiplexorToUse,
                                                                       org.apache.log4j.Logger logger)
Loads all test suites from a given pathspec (may use wildcards).

Parameters:
suiteList - the list of suites
schema - the URL to the copy of the schema for test cases
multiplexorToUse - the Multiplexor to assign to the suites
logger - the logger to use for tracking progress
Returns:
the map of suite names to suites