Namespace: OpenEdge.ABLUnit.Runner
Class
ABLRunner
Parent classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object
Implements: OpenEdge.Logging.ISupportLogging

Copyright (c) 2013-2020 by Progress Software Corporation. All rights reserved.
File:ABLRunner
Purpose:Runner of the ABLUnit framework, which runs the testclasses, test procedures, testsuite classes,
testsuite procedures and ABL files inside a folder.
Author(s):hgarapat
Created:Wed Jun 27 18:18:40 IST 2012
Notes:Modified the annotations. The newly modified annotations are common for both class and procedure files.
Current annotations are Before, Setup, Test, TearDown, After.




Method Summary
Options Name Purpose
OpenEdge.Core.Collections.Array BuildAnnotationInfo (JsonObject) /* Create an Array of AnnotationInfo objects from the JSON data @param JsonObject The annotation JSON data @return Array An array of annotation data. Will always be a valid object */
CHARACTER BuildAttributeValue (character, JsonObject) /* Builds the attribute value, as ABLUnit expects it "value,value2" etc The annotation data format is "anno-name" : {"x": "y"} // x=y split up {"x": ["p", "q"]} // x=y split up null // no parens in source @param character The attribute name. If blank or null, the null string is returned @param JsonObject The annotation data. If invalid, the null string is returned @return character The attribute value, joined together */
OpenEdge.ABLUnit.Reflection.TypeInfo BuildTypeInfo (character, character) /*------------------------------------------------------------------------------ Generates the procedure information in xref xml file @param character The ABL program (.P, .CLS, or .R) file name @return TypeInfo Unit test type info about the program ------------------------------------------------------------------------------*/
FindXrefFiles () This method will locate any local XREF files if configured to do so.
CHARACTER GetFullPathname (character) This method will return the full path of a given file.
CHARACTER getRelativePathOfClasses (character) /** returns the relative path of the classes if the input is of qualified type. **/
CHARACTER GetXRefFile (character, character) /*------------------------------------------------------------------------------ This method should return a valid XREF path which physically exists on disk. As XREF files can be created using different patterns for file extensions (based on how the file was compiled), we need to create a couple of standard candiate filenames using the expected file extension. The order for locating a valid XREF file will use the following steps: 1. Use the given test case (type: class or procedure) replacing the file extension: 1a. Create a candidate filename using a common pattern for the PCTCompile task. 1b. Create a candidate filename using a common pattern for PDSOE/Explicit naming. 2. Search for a matching XREF filename in a list of potential, available files. 3. Return ? if no matching XREF file was located. @param character The test case being examined for addition to ABLUnit @param character The expected type of test case (class or proc[edure]) @return character The located XREF file (or ? if not found) ------------------------------------------------------------------------------*/
HandleTestSuiteClasses (TestEntity, character)
HandleTestSuiteProcedures (TestEntity, character)
LONGCHAR loadSerializedTree (TestEntity) /*------------------------------------------------------------------------------ load serialized tree ------------------------------------------------------------------------------*/
OpenEdge.ABLUnit.Reflection.TypeInfo ParseXMLDocument (character) /*------------------------------------------------------------------------------ Parses the XREF XML file for Test Methods and Procedures ------------------------------------------------------------------------------*/
OpenEdge.ABLUnit.Model.TestEntity populateTestModel (character, integer) /*------------------------------------------------------------------------------ Runs the corresponding method based on the type of the testcase. ------------------------------------------------------------------------------*/
populateTestModel (character, integer, TestEntity) /*------------------------------------------------------------------------------ populates the model based on the test input. looks at all the relavant test methods,internal procedures in the test input. ------------------------------------------------------------------------------*/
populateTestModelForInternalProcs (handle, character, ProcedureAnnotationInfo, TestInfo, logical, TestEntity)
populateTestModelForProcedureType (character, character, TestEntity) /*------------------------------------------------------------------------------ Given a test procedure and test internal procedure, this method will store and run the test procedures and calls a method which writes the results in the xml file Notes: ------------------------------------------------------------------------------*/
populateTestModelForTestCase (character, character, TestEntity) /*------------------------------------------------------------------------------ Compiles and call the corresponding method or internal procedure to run the testcase ------------------------------------------------------------------------------*/
populateTestModelForTestClass (character, character, TestEntity) /*------------------------------------------------------------------------------ Given a testclass and test method, this method will store and run the test methods and calls a method which writes the results in the xml file ------------------------------------------------------------------------------*/
populateTestModelForTestFolder (character, TestEntity) /*------------------------------------------------------------------------------ populates the test model for the ABL Unit files inside the testfolder ------------------------------------------------------------------------------*/
populateTestModelForTestMethod (Object, character, ClassAnnotationInfo, TestInfo, logical, TestEntity)
populateTestModelForTestSuite (TestInfo, TestEntity) /* Iterates through all the test cases in the TestSuite annotations */
ProcessTestResult (TestEntity, TestTypeResult) /* Processes a test entity's TestResult based on status @param TestEntity The entity to process @param TestTypeResult The summary to which this result aggregates */
RecurseDir (character, character) This method will recurse into a directory and build a TT structure.
RunTests () This method runs the tests that are passed as JsonObject.
OpenEdge.ABLUnit.Results.TestTypeResult runtests (TestEntity, character) /* Runs a TestEntity and aggregates results @param TestEntity The entity being run (class/method/suite/root) @param character The ABLUnit output file (not results.xml) @return TestTypeResult The aggregate result for this test entity */
INTEGER ScoreMatches (Array, Array) Produce a score for 2 files based on the # of matching directories.
updateFile (character, longchar, logical) /*------------------------------------------------------------------------------ writes to the update file the given content. If override is true, the file is overwritten. ------------------------------------------------------------------------------*/
UpdateIgnoreDetails (TestTestResult, TestEntity, character, TestTypeResult)
updateStackTrace (Error, character, character) /*------------------------------------------------------------------------------ updates stack trace with the given error in the given file ------------------------------------------------------------------------------*/
updateStackTrace (Stop, character, character) /* Writes a stack trace for a stop condition @param Progress.Lang.Stop THe stop condition @param character The file into which to write @param character The ID of the test entity */
updateStackTraceProperty ()

Constructor Summary
Options Name Purpose
ABLRunner () /* Default constructor */
ABLRunner (TestConfig, character) This is newly added constructor, which accepts formatted JSON object of configuration file.

Property Summary
Options Name Purpose
OpenEdge.Logging.ILogWriter Logger


Method Detail
Top

PRIVATE OpenEdge.Core.Collections.Array BuildAnnotationInfo (JsonObject)

/* Create an Array of AnnotationInfo objects from the JSON data
Parameters:
pData Progress.Json.ObjectModel.JsonObject
Returns OpenEdge.Core.Collections.Array
Array An array of annotation data. Will always be a valid object
Top

PRIVATE CHARACTER BuildAttributeValue (character, JsonObject)

/* Builds the attribute value, as ABLUnit expects it "value,value2" etc
The annotation data format is
"anno-name" :
{"x": "y"} // x=y split up
{"x": ["p", "q"]} // x=y split up
null // no parens in source
Parameters:
pAttrName CHARACTER
pAttrData Progress.Json.ObjectModel.JsonObject
Returns CHARACTER
character The attribute value, joined together
Top

PUBLIC OpenEdge.ABLUnit.Reflection.TypeInfo BuildTypeInfo (character, character)

Generates the procedure information in xref xml file
Parameters:
testCase CHARACTER
testType CHARACTER
Returns OpenEdge.ABLUnit.Reflection.TypeInfo
TypeInfo Unit test type info about the program
Top

PROTECTED FindXrefFiles ()

Purpose: This method will locate any local XREF files if configured to do so.
Notes:
Top

PRIVATE CHARACTER GetFullPathname (character)

Purpose: This method will return the full path of a given file.
Notes:
Parameters:
pcFile CHARACTER
Returns CHARACTER
Top

PUBLIC CHARACTER getRelativePathOfClasses (character)

Purpose:
returns the relative path of the classes if the input is of qualified type.
Parameters:
testcase CHARACTER
Returns CHARACTER
Top

PROTECTED CHARACTER GetXRefFile (character, character)

This method should return a valid XREF path which physically exists on disk. As
XREF files can be created using different patterns for file extensions (based
on how the file was compiled), we need to create a couple of standard candiate
filenames using the expected file extension. The order for locating a valid XREF
file will use the following steps:
1. Use the given test case (type: class or procedure) replacing the file extension:
1a. Create a candidate filename using a common pattern for the PCTCompile task.
1b. Create a candidate filename using a common pattern for PDSOE/Explicit naming.
2. Search for a matching XREF filename in a list of potential, available files.
3. Return ? if no matching XREF file was located.
Parameters:
pcTestCase CHARACTER
pcTestType CHARACTER
Returns CHARACTER
character The located XREF file (or ? if not found)
Top

PUBLIC HandleTestSuiteClasses (TestEntity, character)

Parameters:
testEntity OpenEdge.ABLUnit.Model.TestEntity
classes CHARACTER
Top

PUBLIC HandleTestSuiteProcedures (TestEntity, character)

Parameters:
testEntity OpenEdge.ABLUnit.Model.TestEntity
procedures CHARACTER
Top

PUBLIC LONGCHAR loadSerializedTree (TestEntity)

load serialized tree
Parameters:
testEntity OpenEdge.ABLUnit.Model.TestEntity
Returns LONGCHAR
Top

PUBLIC OpenEdge.ABLUnit.Reflection.TypeInfo ParseXMLDocument (character)

Parses the XREF XML file for Test Methods and Procedures
Parameters:
xmlDocument CHARACTER
Returns OpenEdge.ABLUnit.Reflection.TypeInfo
Top

PUBLIC OpenEdge.ABLUnit.Model.TestEntity populateTestModel (character, integer)

Runs the corresponding method based on the type of the testcase.
Parameters:
testCase CHARACTER
testCount INTEGER
Returns OpenEdge.ABLUnit.Model.TestEntity
Top

PRIVATE populateTestModel (character, integer, TestEntity)

populates the model based on the test input. looks at all the relavant test methods,internal procedures in the test input.
Parameters:
testCase CHARACTER
testCount INTEGER
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForInternalProcs (handle, character, ProcedureAnnotationInfo, TestInfo, logical, TestEntity)

Parameters:
procHandle HANDLE
testProcedureName CHARACTER
procAnnotInfo OpenEdge.ABLUnit.Reflection.ProcedureAnnotationInfo
testProcInfo OpenEdge.ABLUnit.Reflection.TestInfo
runAllProcs LOGICAL
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForProcedureType (character, character, TestEntity)

Given a test procedure and test internal procedure, this method will store and
run the test procedures and calls a method which writes the results in the xml file
Notes:
Parameters:
testProcedureName CHARACTER
testInternalProcedure CHARACTER
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForTestCase (character, character, TestEntity)

Compiles and call the corresponding method or internal procedure to run the testcase
Parameters:
testCase CHARACTER
test CHARACTER
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForTestClass (character, character, TestEntity)

Given a testclass and test method, this method will store and
run the test methods and calls a method which writes the results in the xml file
Parameters:
testClassName CHARACTER
testMethod CHARACTER
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForTestFolder (character, TestEntity)

populates the test model for the ABL Unit files inside the testfolder
Parameters:
testFolder CHARACTER
testEnity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForTestMethod (Object, character, ClassAnnotationInfo, TestInfo, logical, TestEntity)

Parameters:
testClassType Progress.Lang.Object
testClassName CHARACTER
classAnnotInfo OpenEdge.ABLUnit.Reflection.ClassAnnotationInfo
pTestMethodInfo OpenEdge.ABLUnit.Reflection.TestInfo
runAllMethods LOGICAL
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PUBLIC populateTestModelForTestSuite (TestInfo, TestEntity)

/*
Iterates through all the test cases in the TestSuite annotations
Parameters:
testSuiteList OpenEdge.ABLUnit.Reflection.TestInfo
testEntity OpenEdge.ABLUnit.Model.TestEntity
Top

PRIVATE ProcessTestResult (TestEntity, TestTypeResult)

/* Processes a test entity's TestResult based on status
Parameters:
pEntity OpenEdge.ABLUnit.Model.TestEntity
pSummary OpenEdge.ABLUnit.Results.TestTypeResult
Top

PROTECTED RecurseDir (character, character)

Purpose: This method will recurse into a directory and build a TT structure.
Notes:
Parameters:
pcFrom CHARACTER
pcExtMask CHARACTER
Top

PUBLIC RunTests ()

Purpose: This method runs the tests that are passed as JsonObject.
Notes:
Top

PUBLIC OpenEdge.ABLUnit.Results.TestTypeResult runtests (TestEntity, character)

/* Runs a TestEntity and aggregates results
Parameters:
testEntity OpenEdge.ABLUnit.Model.TestEntity
The entity being run (class/method/suite/root)
pUpdateFile CHARACTER
Returns OpenEdge.ABLUnit.Results.TestTypeResult
TestTypeResult The aggregate result for this test entity
Top

PRIVATE INTEGER ScoreMatches (Array, Array)

Purpose: Produce a score for 2 files based on the # of matching directories.
Notes:
Parameters:
poTestPath OpenEdge.Core.Collections.Array
poMatchedFiles OpenEdge.Core.Collections.Array
Returns INTEGER
Top

PUBLIC updateFile (character, longchar, logical)

writes to the update file the given content. If override is true, the file is overwritten.
Parameters:
pUpdateFile CHARACTER
content LONGCHAR
override LOGICAL
Top

PRIVATE UpdateIgnoreDetails (TestTestResult, TestEntity, character, TestTypeResult)

Purpose:
Notes:
Parameters:
testResult OpenEdge.ABLUnit.Results.TestTestResult
testEntity OpenEdge.ABLUnit.Model.TestEntity
testName CHARACTER
summaryResult OpenEdge.ABLUnit.Results.TestTypeResult
Top

PRIVATE updateStackTrace (Error, character, character)

updates stack trace with the given error in the given file
Parameters:
errorResult Progress.Lang.Error
pUpdateFile CHARACTER
id CHARACTER
Top

PRIVATE updateStackTrace (Stop, character, character)

/* Writes a stack trace for a stop condition
Parameters:
pStop Progress.Lang.Stop
pUpdateFile CHARACTER
pId CHARACTER
Top

PRIVATE updateStackTraceProperty ()



Constructor Detail
Top

PUBLIC ABLRunner ()

/* Default constructor
Top

PUBLIC ABLRunner (TestConfig, character)

Purpose: This is newly added constructor, which accepts formatted JSON object of configuration file.
Notes:
Parameters:
inputConfig OpenEdge.ABLUnit.Runner.TestConfig
pUpdateFile CHARACTER


Property Detail
Top

PUBLIC OpenEdge.Logging.ILogWriter Logger

Returns OpenEdge.Logging.ILogWriter


Copyright © 2020 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 12.2.0