UnitTestHarness  1.0
Unit Testing Tool
 All Data Structures Namespaces Files Functions Variables Pages
fwUnitTestComponentTestDiscovery.ctl File Reference

Automatically finds the test suites and test cases. More...

Functions

void fwUnitTestComponentTestDiscovery_testDiscoveryForComponent (const string componentName, mapping &scriptsTestRoutines)
 
string fwUnitTestComponentTestDiscovery_getTestScriptPathName (const string componentName, string scriptName)
 
void fwUnitTestComponentTestDiscovery_getTests (mapping &tests)
 
dyn_string fwUnitTestComponentTestDiscovery_appendArraysNoDuplicates (dyn_string array1, dyn_string array2)
 
void fwUnitTestComponentTestDiscovery_getTestSuiteFiles (const dyn_string componentsToTest, mapping &testSuiteFiles)
 
private dyn_string fwUnitTestComponentTestDiscovery_getScriptsForComponentsPath (const string componentName, const string path)
 
void fwUnitTestComponentTestDiscovery_getTestScriptsFrom (const string testPath, dyn_string &testFiles)
 
private void fwUnitTestComponentTestDiscovery_getTestScriptsRecurse (const string testPath, dyn_string componentsToExclude, dyn_string &testFiles)
 
private bool doesNotAlreadyContainTestScript (dyn_string testFiles, string toBeAddedTestScript)
 
void fwUnitTestComponentTestDiscovery_getTestCaseRoutines (const dyn_string testScriptPathNames, mapping &scriptsTestRoutines)
 
bool fwUnitTestComponentTestDiscovery_getTestRoutinesFromScript (const string testScriptPathName, dyn_string &testRoutines)
 
bool fwUnitTestComponentTestDiscovery_getSuiteSetupRoutineFromScript (const string testScriptPathName, string &suiteSetupRoutine)
 
bool fwUnitTestComponentTestDiscovery_getSuiteTeardownRoutineFromScript (const string testScriptPathName, string &suiteTeardownRoutine)
 
bool fwUnitTestComponentTestDiscovery_getCaseSetupRoutineFromScript (const string testScriptPathName, string &caseSetupRoutine)
 
bool fwUnitTestComponentTestDiscovery_getCaseTeardownRoutineFromScript (const string testScriptPathName, string &caseTeardownRoutine)
 
private bool fwUnitTestComponentTestDiscovery_getRoutinesThatMatchPattern (const string testScriptPathName, const dyn_string patterns, dyn_string &testRoutines)
 
private bool fwUnitTestComponentTestDiscovery_multiPatternMatch (const dyn_string patterns, const string line)
 

Variables

const dyn_string TEST_DIRECTORIES = makeDynString("/scripts/test/", "/scripts/libs/test/", "/scripts/libs/Test/", "/scripts/Test/")
 

Detailed Description

Automatically finds the test suites and test cases.

Creation Date
01/04/2014

Function Documentation

private bool doesNotAlreadyContainTestScript ( dyn_string  testFiles,
string  toBeAddedTestScript 
)
Description: Used to stop both "/scripts/libs/test/" and "/scripts/libs/Test/" paths for a test being added when using MS Windows.
Usage
Public
Parameters
[in]toBeAddedTestFilestring
[out]testFilesdyn_string, list of test files within the testPath
dyn_string fwUnitTestComponentTestDiscovery_appendArraysNoDuplicates ( dyn_string  array1,
dyn_string  array2 
)
Description: Append array2 to array1 without adding duplicates. (union of two arrays)
When given a file path name the name of the files are compared(without the path). Priority is given to array1.
Usage
Public
Parameters
[in]array1dyn_string, Array to be appended to.
[in]array2dyn_string, Array to be appended.
Returns
dyn_string The result of appending the arrays.
bool fwUnitTestComponentTestDiscovery_getCaseSetupRoutineFromScript ( const string  testScriptPathName,
string &  caseSetupRoutine 
)
Description: Gets the Setup routine belonging to the given test script.
Usage
Public
Parameters
[in]testScriptPathNamestring,
[out]caseSetupRoutinestring,
bool fwUnitTestComponentTestDiscovery_getCaseTeardownRoutineFromScript ( const string  testScriptPathName,
string &  caseTeardownRoutine 
)
Description: Gets the Teardown routine belonging to the given test script.
Usage
Public
Parameters
[in]testScriptPathNamestring,
[out]caseTeardownRoutinestring,
private bool fwUnitTestComponentTestDiscovery_getRoutinesThatMatchPattern ( const string  testScriptPathName,
const dyn_string  patterns,
dyn_string &  testRoutines 
)
Description: Gets a list of all routines within the given script, that match any of the given patterns.
Usage
Public
Parameters
[in]testScriptPathNamestring, Script to be searched.
[in]patternsdyn_string
[out]testRoutinesdyn_string, List of routines that matches the given patterns.
private dyn_string fwUnitTestComponentTestDiscovery_getScriptsForComponentsPath ( const string  componentName,
const string  path 
)
Description: Gets the list of test script files for the given component within the given path.
See also
getTestSuiteFiles()
Usage
Public
Parameters
[in]componentNamestring, the name of the component you wish to find the tests for.
[in]pathstring, will either be the PROJ_PATH or installationDirectoryPath
bool fwUnitTestComponentTestDiscovery_getSuiteSetupRoutineFromScript ( const string  testScriptPathName,
string &  suiteSetupRoutine 
)
Description: Gets the suiteSetup routine belonging to the given test script.
Usage
Public
Parameters
[in]testScriptPathNamestring,
[out]suiteSetupRoutinestring,
bool fwUnitTestComponentTestDiscovery_getSuiteTeardownRoutineFromScript ( const string  testScriptPathName,
string &  suiteTeardownRoutine 
)
Description: Gets the suiteTeardown routine belonging to the given test script.
Usage
Public
Parameters
[in]testScriptPathNamestring,
[out]suiteTeardownRoutinestring,
void fwUnitTestComponentTestDiscovery_getTestCaseRoutines ( const dyn_string  testScriptPathNames,
mapping &  scriptsTestRoutines 
)
Description: For each of the given testScriptPathNames finds the test case routines it contains.
Usage
Public
Parameters
[in]testScriptPathNamesdyn_string, List of all the test script path names
[out]scriptsTestRoutinesmapping, key = testScriptPathName, value = test case routines
bool fwUnitTestComponentTestDiscovery_getTestRoutinesFromScript ( const string  testScriptPathName,
dyn_string &  testRoutines 
)
Description: Finds all test routines in the given file.
Usage
Public
Parameters
[in]testScriptPathNamesstring
[out]testRoutinesdyn_string, The test routines found within the testScript
void fwUnitTestComponentTestDiscovery_getTests ( mapping &  tests)
Description: Get all the tests within the project(including within the installationDirectoryPath).
Usage
Public
Parameters
[out]testsmapping, key= component name, value=(mapping key = suitesToRun, value = test cases)
string fwUnitTestComponentTestDiscovery_getTestScriptPathName ( const string  componentName,
string  scriptName 
)
Description: In the XML file the path to the test scripts are not present. So we add the path to the
test scripts.
Usage
Public
Parameters
[in]componentNamestring, The component the test script belongs to.
[in]scriptNamestring, the name of the test script you wish to find the path of.
Returns
testScriptPathName string
void fwUnitTestComponentTestDiscovery_getTestScriptsFrom ( const string  testPath,
dyn_string &  testFiles 
)
Description: Gets the tests scripts from the test path.
Usage
Public
Parameters
[in]testPathstring, Path to look in for the test scripts.
[out]testFilesdyn_string, list of test files within the testPath
private void fwUnitTestComponentTestDiscovery_getTestScriptsRecurse ( const string  testPath,
dyn_string  componentsToExclude,
dyn_string &  testFiles 
)
Description: fwUnitTestComponentTestDiscovery_getTestScriptsFrom()
Usage
Public
Parameters
[in]testPathstring, Path to look in for the test scripts.
[in]componentsToExcludedyn_string, Paths to exclude, used to stop multiple calls with the same filePath.
[out]testFilesdyn_string, list of test files within the testPath
void fwUnitTestComponentTestDiscovery_getTestSuiteFiles ( const dyn_string  componentsToTest,
mapping &  testSuiteFiles 
)
Description: Gets the list of test script files. If a test script is within the project path and
within the installation directory then priority is given the the version in the project path.
Usage
Public
Parameters
[in]componentsToTestdyn_string, the name of the components you wish to find the tests for.
[out]testSuiteFilesmapping, the key is the name of the component, value is dyn_string of pathnames for the test suite files
private bool fwUnitTestComponentTestDiscovery_multiPatternMatch ( const dyn_string  patterns,
const string  line 
)
Description: fwUnitTestComponentTestDiscovery_getRoutinesThatMatchPattern()
Usage
Public
Parameters
[in]patternsdyn_string,
[in]linestring,
Returns
bool, true if the line matches any of the given patterns.
void fwUnitTestComponentTestDiscovery_testDiscoveryForComponent ( const string  componentName,
mapping &  scriptsTestRoutines 
)
Description: Gets the test scripts and test routines for the given component.
Usage
Public
Parameters
[in]componentNamestring, The component the test script belongs to.
[out]scriptsTestRoutinesmapping, key = script path name, value = string[] of test routines.

Variable Documentation

const dyn_string TEST_DIRECTORIES = makeDynString("/scripts/test/", "/scripts/libs/test/", "/scripts/libs/Test/", "/scripts/Test/")